Re: [HACKERS] Re: Regress tests reveal *serious* psql bug

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: Regress tests reveal *serious* psql bug
Date: 2000-01-12 05:53:13
Message-ID: 200001120553.AAA11692@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Peter Eisentraut <peter_e(at)gmx(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-01-12 06:15:00 Re: Regress tests reveal *serious* psql bug
Previous Message Tom Lane 2000-01-12 05:42:30 Re: [HACKERS] Re: Regress tests reveal *serious* psql bug