Re: PL/pgSQL loops?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: "Johnny Jrgensen" <pgsql(at)halfahead(dot)dk>, pgsql-sql(at)postgresql(dot)org
Subject: Re: PL/pgSQL loops?
Date: 2001-11-29 17:02:55
Message-ID: 19090.1007053375@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> In addition, this seems to work:
> for intvar in 1 .. (select max(a) from a) LOOP
> and this doesn't:
> for intvar in 1 .. (select max(loop) from a) LOOP
> and this does:
> for intvar in (select max(loop) from a) .. 1 LOOP

> I'm guessing that plpgsql doesn't want to try to determine if
> an expression is valid and so just concats stuff to pass off,

Correct ...

> but that seems to mean that you need to double quote loop in
> the second (which is somewhat unobvious).

I would've expected it to count nested parentheses, at least.
A quick look makes it appear that some places in plpgsql's
gram.y do, and some don't. Ugh.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tony Reina 2001-11-29 19:01:11 Can I CONSTRAIN a particular value to be UNIQUE?
Previous Message Esger Abbink 2001-11-29 16:56:30 need some help understanding sloq query