Re: pl/pgsql - code review + question

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: pl/pgsql - code review + question
Дата
Msg-id web-88026@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Re: pl/pgsql - code review + question  ("Richard Huxton" <dev@archonet.com>)
Список 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@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

Вложения

В списке pgsql-sql по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Query optimizing - paradox behave
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Re: Query optimizing - paradox behave