2

The Vertica database table I'm using has a column called: incident.date

I connect to it ok:

install.packages("RJDBC",dep=TRUE)
library(RJDBC)
vDriver <- JDBC(driverClass="com.vertica.jdbc.Driver", classPath="C:/Vertica/vertica jar/vertica-jdbc-7.0.1-0.jar")
vertica <- dbConnect(vDriver, "jdbc:vertica://127.0.0.1:5433/dir", "name", "pass")

I can pull a regular query from it:

myframe = dbGetQuery(vertica, "Select * from output_servers")

but if I want specific column with a dot in the name, I get an error.

myframe = dbGetQuery(vertica, "Select product, incident, incident.date from output_servers")

    Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set for ",  : 
    Unable to retrieve JDBC result set for Select product, incident, incident.date from output_servers ([Vertica][VJDBC](4566) ERROR: Relation "incident" does not exist)

I've tried square brackets, backticks, single and double quotes, and backslashes around the column name. I'm pretty sure it's simple, but what am I missing? Thanks!

David Arenburg
  • 91,361
  • 17
  • 137
  • 196
Oleg
  • 303
  • 2
  • 14

1 Answers1

1

I found it:

myframe = dbGetQuery(vertica, "Select product, incident, \"incident.date\" from output_servers")

Apparently it's Vertica that cares, not R.

Oleg
  • 303
  • 2
  • 14
  • Yes. That period in the column name is likely being interpreted as {table}.{column}. I would have some strong words for the DBA if I ran into that in the wild. – bpanulla Jan 12 '15 at 23:31