Re: info about patch: using parametrised query in psql - Mailing list pgsql-hackers

From Robert Haas
Subject Re: info about patch: using parametrised query in psql
Date
Msg-id 603c8f070912251117m3a97f32dnffe7ca0aa74f395f@mail.gmail.com
Whole thread Raw
In response to Re: info about patch: using parametrised query in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: info about patch: using parametrised query in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Dec 25, 2009 at 2:12 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> If we do want to go
>> with a single flag character, maybe it should just be a single or
>> double quote:
>
>> :'foo - quote as a literal
>> :"foo - quote as an ident
>
> I would've proposed that myself if I thought it would work, but I'm
> afraid that it will wreak complete chaos from a parsing standpoint.
> Half the tools in the world will think this is an incomplete literal,
> and I'm not even very sure you could keep psql itself from getting
> confused.
>
> Hmm ... actually, though, what about combining the ideas:
>
>        :'foo' - quote as a literal
>        :"foo" - quote as an ident
>
> This leaves us with nothing much as far as extensibility, but from
> a mnemonic standpoint it's a large win.

Works for me.  One small problem discussed upthread is that there
currently doesn't appear to be a libpq function that does
ident-quoting.  I'm thinking that we will need to add one to make this
work - is that going to be a problem?  I'm thinking that since we're
just adding a function it won't force an uncomfortable major-version
bump on libpq.

I guess the other thing that is bad about this is that someone might
be forgiven for thinking that quotation marks were the way to include
a space in the variable name. But that may be a downside that we can
just live with.

...Robert


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: info about patch: using parametrised query in psql
Next
From: Tom Lane
Date:
Subject: Re: ORDER BY clause in aggregate doesn't work well with multi argument aggregates