Re: [pgsql-jdbc] dollar-quoted CREATE FUNCTION statement fails - Mailing list pgsql-jdbc

From Michael Paesold
Subject Re: [pgsql-jdbc] dollar-quoted CREATE FUNCTION statement fails
Date
Msg-id 4522DA56.4070105@gmx.at
Whole thread Raw
In response to Re: [pgsql-jdbc] dollar-quoted CREATE FUNCTION statement fails  (Michael Paesold <mpaesold@gmx.at>)
Responses Re: [pgsql-jdbc] dollar-quoted CREATE FUNCTION statement  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
Michael Paesold wrote:
 > Here is a first version of the patch. It works well for me so far, so
 > I am asking for comments now.

Before everyone forgets about my patch in the discussion about the later
patch by Jure Koren...

I have already spent some hours on doing research, coding, creating the
test case. So I am willing to improve my work, of course. It just much
easier with input from the community. I would really welcome any
suggestions or criticism.

While at it, don't you think that we should handle SQL comments in
parseQuery? For example when loading a schema from a file using JDBC,
there might be comments in it that will break the current code. Does the
JDBC spec say anything about that matter?

One other thing that I wanted to try is to not parse the whole query in
a single loop, but instead split up the parsing a bit more, in the style of:

case '"': scan for next '"';
case '\'': scan for matching '\'';
case '$': if dollar-quote, scan for end of dollar-quote

It would simplify the other branches of the switch statement and we
could get rid of the if (!in... && !in...) stuff, then.

Do you think that would be an improvement?

Best Regards
Michael Paesold






pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: dollar quoting
Next
From: Kris Jurka
Date:
Subject: Re: [pgsql-jdbc] dollar-quoted CREATE FUNCTION statement