Guest User

Untitled

a guest
Aug 23rd, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. writing tables to Postgresql using rPostgreSQL when the database name is all capital letters
  2. library(RPostgreSQL)
  3. con <- dbConnect(PostgreSQL(), host="myhost",
  4. user= "postgres", password="myPass", dbname="DATA")
  5. dbWriteTable(con, "test", myDf)
  6.  
  7. Error in postgresqlExecStatement(conn, statement, ...) :
  8. RS-DBI driver: (could not Retrieve the result : ERROR: no schema has been selected to create in
  9. )
  10. [1] FALSE
  11.  
  12. edd@max:~$ createdb DATA
  13. edd@max:~$ psql DATA
  14. psql (8.4.8)
  15. Type "help" for help.
  16.  
  17. DATA=# q
  18. edd@max:~$
  19.  
  20. R> library(RPostgreSQL)
  21. R> con <- dbConnect(PostgreSQL(), host="localhost", user= "edd",
  22. + password=".....", dbname="DATA")
  23. R> con
  24. <PostgreSQLConnection:(21936,0)>
  25. R> dbWriteTable(con, "quicktest", cars)
  26. [1] TRUE
  27. R>
  28.  
  29. DATA=# select * from quicktest limit 5;
  30. row_names | speed | dist
  31. -----------+-------+------
  32. 1 | 4 | 2
  33. 2 | 4 | 10
  34. 3 | 7 | 4
  35. 4 | 7 | 22
  36. 5 | 8 | 16
  37. (5 rows)
  38.  
  39. DATA=#
Add Comment
Please, Sign In to add comment