Problems with comments in SQL code

Sjoerd Mullender sjoerd at monetdb.org
Fri Oct 17 12:47:34 CEST 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 291 bytes
Desc: OpenPGP digital signature
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20141017/7aaac2ce/attachment.sig>


More information about the developers-list mailing list