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

From: Michael Paesold <mpaesold(at)gmx(dot)at>
To: pgsql-jdbc(at)postgresql(dot)org
Cc: Dave Cramer <pg(at)fastcrypt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [pgsql-jdbc] dollar-quoted CREATE FUNCTION statement fails
Date: 2006-10-03 21:47:02
Message-ID: 4522DA56.4070105@gmx.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Paesold 2006-10-03 22:00:46 Autogenerated keys and ... RETURNING
Previous Message Tom Lane 2006-10-03 20:51:16 Re: dollar quoting