Re: quoting psql varible as identifier

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: quoting psql varible as identifier
Date: 2010-01-28 09:53:35
Message-ID: 162867791001280153w28d74279hf86410bb09e7e83f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2010/1/27 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Mon, Jan 25, 2010 at 7:36 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> I hope, so this version is more readable and more clean. I removed
>> some not necessary checks.
>
> This still seems overly complicated to me.  I spent a few hours today
> working up the attached patch.  Let me know your thoughts.
>

There is serious issue. The "psql_error" only shows some message on
output, but do nothing more - you don't set a result status for
commands and for statements. So some potential error from parsing is
pseudo quietly ignored - without respect to your setting
ON_ERROR_STOP. This could be a problem for commands. Execution of
broken SQL statements will raise syntax error. But for \set some
variable will be a broken and the content can be used. I don't thing
so it is good. It is limited.

Your version is acceptable only when we don't enable escape syntax for
commands. Then we don't need check it. On your version - I am not sure
if it is fully compatible, and using a global variables isn't nice.

I little bit modify my original code - it is more verbose (- useless
using pqexpbuffer) - and more consistent with previous behave.

Pavel

> ...Robert
>

Attachment Content-Type Size
variable-escaping.diff application/octet-stream 12.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-01-28 10:22:36 Re: Streaming replication, and walsender during recovery
Previous Message Tim Bunce 2010-01-28 09:25:51 Re: Add on_perl_init and proper destruction to plperl [PATCH]