plpgsql: can I use a variable in a DECLARE later whithin the DECLARE?

Поиск
Список
Период
Сортировка
От
Тема plpgsql: can I use a variable in a DECLARE later whithin the DECLARE?
Дата
Msg-id 20211029121435.GA5414@tuxteam.de
обсуждение исходный текст
Ответы Re: plpgsql: can I use a variable in a DECLARE later whithin the DECLARE?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

In plpgsql, i'm trying to use a variable initialised in a DECLARE in
a later initialisation expression whithin the same DECLARE:

  DECLARE
    x int := 23;
    y int := x + 4
  BEGIN
   ...

Experiments suggest that it works, but the docs are silent about that.
Is this a good idea, or should I be more careful and do it in a nested
block?

(For Lispers: is that a let, or a let*? ;-)

Thanks & cheers
 - tomás

Вложения

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

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: Support for NSS as a libpq TLS backend
Следующее
От: Robert Haas
Дата:
Сообщение: Re: when the startup process doesn't (logging startup delays)