Small problem with embedded comments in a statement

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Small problem with embedded comments in a statement
Date: 2006-09-26 09:07:52
Message-ID: efaql9$jnj$1@sea.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

When running the following query:

String sql = "select * from table1\n" +
"--select * from table2;\n" +
"--select * from table3";

I get an error:
org.postgresql.util.PSQLException: Multiple ResultSets were returned by the query.

But as the second and third SELECT are behing a comment, they should be ignored,
right? Actually when removing the semicolon after table2, then everything works
fine.

Is this a bug in the JDBC driver, or is this intended behaviour?

Best regards
Thomas

P.S.: before you ask why I run such a SQL statement: I'm maintaining an
open-source query tool and sometimes unwanted statements are simply un-commented
from within the editor, but the application still sends the whole string that
the user supplied.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Luis Vilar Flores 2006-09-26 10:09:10 Re: bytea memory improvement
Previous Message Markus Schaber 2006-09-26 08:49:10 Re: Bind message