Re: dollar quoting with flex - Mailing list pgsql-patches

From Tom Lane
Subject Re: dollar quoting with flex
Date
Msg-id 23650.1077648176@sss.pgh.pa.us
Whole thread Raw
In response to dollar quoting with flex  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-patches
Andrew Dunstan <andrew@dunslane.net> writes:
> Attached is a patch for dollar quoting in the backend and in psql (with
> the new flex scanner). I'm fairly confident about the backend (because
> this is mainly Tom's work adapted :-) ) but rather less so about psql -
> I don't entirely understand all the odd states in psql's scanner. I'm
> not sure that I have freed up memory in all the necessary cases. Nor am
> I sure what the state is or should be if we end an included file in a
> dollar-quoting state, nor how to handle such a situation. So, some extra
> eyeballs would be appreciated.

I'll take a look soon.  The psql behavior is that a new lexer is
instantiated for each include-file level, which means that quoting
states can't persist across file boundaries.  This emulates the behavior
of the old handmade lexing code, and seems fairly reasonable to me.
(By definition, you weren't in a quoting state when you recognized the
\i command, and so you shouldn't be when you come out of the include
file.)  We could argue about that if people want to reconsider it, but
it seems orthogonal to the dollar-quoting change to me.

            regards, tom lane

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: dollar quoting with flex
Next
From: Tom Lane
Date:
Subject: Re: dollar quoting with flex