From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] dollar quoting |
Date: | 2004-02-08 20:14:11 |
Message-ID: | 40269893.10907@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Andrew Dunstan wrote:
>
>
> Tom Lane wrote:
>
>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>
>>
>>> After staring at the code for a long time, I think I see how to do
>>> this. It's complicated a bit by the fact that $ is a valid
>>> identifier character. So my current thinking is to say that if we
>>> see $ not in a quote and not preceded by a valid identifier char
>>> then it is the start of a $foo$ sequence. Or have I missed
>>> something? Can we validly see $ in any other context?
>>>
>>
I had missed one, though - numbered params in prepared statements. Fixed
in attached patch.
>>
>> Right, a $ should be considered to start a quote marker only if it's not
>> part of an identifier. The backend lexer doesn't have a problem with
>> this because it's written in flex, but I can imagine that getting it
>> right in psql's ad-hoc parser might be tricky.
>>
>
> I think it's doable, though. I seem to have a working patch, which I
> will send out for review soon.
>
Proof of Concept patch (i.e. not for application) attached for review.
The scanner changes are based on Tom's original, with some name/comment
changes and a more liberal pattern. The psql changes are all my own work
:-).
Comments welcome. Reviewers: I am not sure I got multi-byte stuff right
in psql/mainloop.c - please pay close attention to that.
If I'm not wildly off course I will polish this up and start on docs.
cheers
andrew
Attachment | Content-Type | Size |
---|---|---|
dq-amd.patch | text/plain | 8.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Brown | 2004-02-08 21:54:51 | Re: [pgsql-hackers-win32] Sync vs. fsync during checkpoint |
Previous Message | Thomas Hallgren | 2004-02-08 19:56:24 | Re: session persistent data for plperl |
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2004-02-08 21:24:25 | Updated win32 readdir patch |
Previous Message | David Garamond | 2004-02-08 18:30:44 | Re: connectby for BYTEA keys |