Re: [HACKERS] Re: Regress tests reveal *serious* psql bug - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Re: Regress tests reveal *serious* psql bug
Date
Msg-id 200001120553.AAA11692@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: Regress tests reveal *serious* psql bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Re: Regress tests reveal *serious* psql bug
List pgsql-hackers
> Peter Eisentraut <peter_e@gmx.net> writes:
> >> We recommended the : in the first place because it is the standard for
> >> embedded SQL variable handling.
> 
> > So the array syntax should be changed?
> 
> Bzzt, wrong answer.
> 
> I'm open to alternative answers on this, but breaking existing
> application scripts is not one of the acceptable alternatives.
> 
> *Especially* not if there's no obvious failure report, as there
> will not be if we don't change psql's behavior.

I think we can live with requiring a variable name to start with an
alphabetic or underscore.
SELECT a[1:2]

is clear and
SELECT a[1:myvar]

expands to SELECT a[1].  I think we can live with this since having a
variable as an array element was never possible before 7.0.  We could
get fancy and not expand variables inside brackets.  Of course, quoted
strings have to be skipped.

In fact, I think it should be an error to reference a variable that is
not defined.  This will catch accidental references too.  If you
reference a variable that does not exist like :myvar, it passes the
literal :myvar to the backend.

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: Regress tests reveal *serious* psql bug
Next
From: Tom Lane
Date:
Subject: Re: Regress tests reveal *serious* psql bug