Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

mclient returns nothing but monetdblite returns error #84

Closed
ajdamico opened this issue Nov 16, 2016 · 1 comment
Closed

mclient returns nothing but monetdblite returns error #84

ajdamico opened this issue Nov 16, 2016 · 1 comment

Comments

@ajdamico
Copy link
Contributor

syntax below is the exact same as what triggers the strange behavior reported at https://www.monetdb.org/bugzilla/show_bug.cgi?id=6121

not sure if you think it makes sense for this to be fixed on the monetdb side, or if monetdblite should behave differently? thanks

library(DBI)
library(MonetDBLite)

db <- dbConnect( MonetDBLite() )

dbSendQuery( db , "CREATE TABLE table_one (this_column INTEGER)" )
dbSendQuery( db , "INSERT INTO table_one VALUES (1)" )
dbSendQuery( db , "INSERT INTO table_one VALUES (2)" )
dbSendQuery( db , "INSERT INTO table_one VALUES (3)" )
dbSendQuery( db , "INSERT INTO table_one VALUES (4)" )
dbSendQuery( db , "INSERT INTO table_one VALUES (5)" )

dbSendQuery( db , "CREATE TABLE table_two (this_column INTEGER)" )
dbSendQuery( db , "INSERT INTO table_two VALUES (1)" )
dbSendQuery( db , "INSERT INTO table_two VALUES (2)" )


# # # # related quaries that work without issue

dbGetQuery( db , "SELECT SUM( ( table_one.this_column IN ( SELECT this_column FROM table_two ) ) ) FROM table_one" )
dbGetQuery( db , "SELECT MAX( ( table_one.this_column IN ( SELECT this_column FROM table_two ) ) ) FROM table_one" )
dbGetQuery( db , "SELECT AVG( CASE WHEN table_one.this_column IN ( SELECT this_column FROM table_two ) THEN 1 ELSE 0 END ) AS new_column FROM table_one" )


# # # # three examples with no proper error and no proper result

dbGetQuery( db , "SELECT ( table_one.this_column IN ( SELECT this_column FROM table_two ) ) AS new_column FROM table_one" )
dbGetQuery( db , "SELECT ( CASE WHEN ( table_one.this_column IN ( SELECT this_column FROM table_two ) ) THEN 1 ELSE 0 END ) AS new_column FROM table_one" )
dbGetQuery( db , "SELECT COUNT(*) , ( CASE WHEN ( table_one.this_column IN ( SELECT this_column FROM table_two ) ) THEN 1 ELSE 0 END ) AS new_column FROM table_one GROUP BY new_column" )
@hannes
Copy link
Owner

hannes commented Jan 4, 2017

this seems to work now

@hannes hannes closed this as completed Jan 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants