Re: pl/pgsql - code review + question

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pl/pgsql - code review + question
Date: 2001-07-19 15:19:55
Message-ID: web-88026@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Richard,

> > Josh - if I try and do OFFSET at the same time (presumably it's the
> same
> > change) do you fancy acting as a sanity test site?
>
> What am I talking about - OFFSET is going to be parsed by the SQL
> parser not
> the plpgsql parser.

Not so, not so!

Try the following two PL/pgSQL functions:

DECLARE
h INT;
k INT;
a_row a%ROWTYPE;
BEGIN
h := 1;
k := 3;
SELECT * FROM a INTO a_row
ORDER BY a.1
LIMIT 1 OFFSET (h + k);
END;

... blows up, but ...

DECLARE
h INT;
k INT;
a_row a%ROWTYPE;
BEGIN
h := 1;
k := (3 + h);
SELECT * FROM a INTO a_row
ORDER BY a.1
LIMIT 1 OFFSET k;
END;

... works.

As far as I can tell, PL/pgSQL is not evaluating the expression before
passing it on to the SQL parser. Or is the SQL parser supposed to
accept (1 + 3) ....

Oh, I see what you mean. Sorry! Should I bug-traq this problem?

-Josh

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

Attachment Content-Type Size
unknown_filename text/plain 2 bytes
unknown_filename text/plain 2 bytes
unknown_filename text/plain 2 bytes

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message danno 2001-07-19 15:28:26 querying values defined in a check constraint
Previous Message Stephan Szabo 2001-07-19 15:12:24 Re: Query optimizing - paradox behave