r-dbi / DBI

A database interface (DBI) definition for communication between R and RDBMSs
https://dbi.r-dbi.org
GNU Lesser General Public License v2.1
297 stars 74 forks source link

dbExistsTable with Teradata throws error concerning checking of null values #481

Closed cornejom closed 5 months ago

cornejom commented 5 months ago

Executing dbExistsTable() with a Teradata connection results in an error whose message appears to be unrelated to the purpose of the function. Is there a bad interaction with Teradata?

library(DBI)

MyCon <- dbConnect(drv=teradatasql::TeradataDriver(),
                   host='MyHostAddr',
                   database='MyDB',
                   logmech='LDAP', 
                   user='MyId'),
                   password='MyPwd')
                   ) 

dbCreateTable(MyCon, 'MyTable', c(x = 'INTEGER'))
dbReadTable(MyCon, 'MyTable')

data frame with 0 columns and 0 rows

So far so good. But then ...

dbExistsTable(MyCon, 'MyTable')

Error in obtainRows(res, FALSE, params) : [Version 20.0.0.7] [Session 98477415] [Teradata Database] [Error 3731] The user must use IS NULL or IS NOT NULL to test for NULL values. at gosqldriver/teradatasql.formatError ErrorUtil.go:85 at gosqldriver/teradatasql.(teradataConnection).formatDatabaseError ErrorUtil.go:184 at gosqldriver/teradatasql.(teradataConnection).makeChainedDatabaseError ErrorUtil.go:200 at gosqldriver/teradatasql.(teradataConnection).processErrorParcel TeradataConnection.go:689 at gosqldriver/teradatasql.(TeradataRows).processResponseBundle TeradataRows.go:2300 at gosqldriver/teradatasql.(TeradataRows).executeSQLRequest TeradataRows.go:867 at gosqldriver/teradatasql.newTeradataRows TeradataRows.go:717 at gosqldriver/teradatasql.(teradataStatement).QueryContext TeradataStatement.go:122 at gosqldriver/teradatasql.(teradataConnection).QueryContext TeradataConnection.go:1199 at database/sql.ctxDriverQuery ctxutil.go:48 at database/sql.(DB).queryDC.func1 sql.go:1748 at database/sql.wi

krlmlr commented 5 months ago

Thanks. This seems like an error in the teradatasql package, how did you obtain that? Can you please raise it with the manufacturer/maintainer/author of that package?

cornejom commented 5 months ago

Turns out it was an issue with the previous version of the driver. Latest update, teradatasql 20.0.0.12, works fine. The package is available from https://downloads.teradata.com/download/connectivity/teradata-sql-driver-for-r