Aw: Re: Problems with comments in SQL code

Robert Koch gms_xy at gmx.de
Tue Nov 4 15:16:12 CET 2014


I checked that with DBVisualizer and other database systems (like PostgreSQL, MySQL). The error appears with MonetDB only. So I guess, it's a matter of the MonetDB JDBC driver.

I am aware of the "/* */" comment style, but "--" it is very handy for quickly commenting single lines, and it's ANSI compliant, too.


> Gesendet: Freitag, 17. Oktober 2014 um 11:47 Uhr
> Von: "Sjoerd Mullender" <sjoerd at monetdb.org>
> An: developers-list at monetdb.org
> Betreff: Re: Problems with comments in SQL code
>
> On 17/10/14 11:32, Robert Koch wrote:
> > SELECT
> >     *
> > FROM
> >     sys.storage
> > WHERE 1=1
> >     AND "schema" = 'sapsr3'
> >     AND "table" = 'dfkkop'
> > ;
> > 
> > works in mclient and DBVisualizer (via JDBC)
> > 
> > 
> > SELECT
> >     *
> > FROM
> >     sys.storage
> > WHERE 1=1
> >     AND "schema" = 'sapsr3'
> >     --AND "table" = 'dfkkop'
> > ;
> > 
> > works in mclient, but does not work in DBVisualizer. error message:
> > 
> > 11:23:37  [SELECT - 0 row(s), 0.000 secs]  1) [Error Code: 0, SQL State: 42000]  syntax error, unexpected $end, expecting SCOLON in: "select. 2) [Error Code: 0, SQL State: 22000]      *. 3) [Error Code: 0, SQL State: 22000]  from. 4) [Error Code: 0, SQL State: 22000]      sys.storage. 5) [Error Code: 0, SQL State: 22000]  where 1=1. 6) [Error Code: 0, SQL State: 22000]      and "schema" = 'sapsr3'. 7) [Error Code: 0, SQL State: 22000]      --AND "table" = 'dfkkop';"
> > ... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec  [0 successful, 0 warnings, 1 errors]
> 
> 
> Looks like DBVisualizer turns the embedded line endings into spaces, so
> your comment doesn't end.
> What you can do is use C-style comments: /* ... */.  These are also
> recognized by MonetDB.
> 
> > I also noticed this problem (handling comments) in other statements, especially when comments appear before the semicolon. I am not sure, if this is a problem in JDBC driver or DBVisualizer. To see, what is received by monetdb server, I would like to see log files of SQL queries. I found a directory named "/sql_logs/sql", but it consits of 2 files nearly empty. Where can I enable logging?
> 
> Stay away from those files!  They are an integral part of the database.
>  That directory is for the write-ahead log.
> 
> There is a possibility to enable debugging.  I think you need to add a
> debug=true and logfile=wherever property to the connection URI.
> 
> -- 
> Sjoerd Mullender
> 
> _______________________________________________
> developers-list mailing list
> developers-list at monetdb.org
> https://www.monetdb.org/mailman/listinfo/developers-list
> 



More information about the developers-list mailing list