Re: info about patch: using parametrised query in psql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: info about patch: using parametrised query in psql
Date: 2009-12-25 18:03:05
Message-ID: 162867790912251003h4ea879e5j490fc663dd351fbf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/12/25 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> I think maybe what we need here is a piece of syntax to indicate that a
>> specific parameter should be substituted after first being passed
>> through PQescapeStringConn.
>
> I agree that a global flag that changes the behavior of :foo is a
> seriously bad idea.  Alternate syntax would be much better, but how
> exactly can we shoehorn that in?  Maybe something like
>        :!foo

there are two quoting styles, so we need two syntax. I proposed

:[var] and :{var} - for ident quoting and literal quoting.
Theoretically we could to use :(var) for bytea escaping. :!foo isn't
good idea. It is related to negation operator. Bracket or parenthesis
are good readable and far to some custom pg operators.

Regards
Pavel Stehule

> ie put some non-letter flags between the : and the variable name.
> It would obviously not work to use ::foo, but I think many other
> punctuation characters would be safe (would not conflict with any
> likely SQL usage).  We could have a couple of different flags to
> signal whether you want single or double quoting of the variable
> value.
>
>                        regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matteo Beccati 2009-12-25 18:17:43 Re: PQescapeByteaConn and the new hex encoding
Previous Message Tom Lane 2009-12-25 17:54:26 Re: PQescapeByteaConn and the new hex encoding