Re: Any reasons for 'DO' statement not returning result?

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: Any reasons for 'DO' statement not returning result?
Дата
Msg-id 76a7122c-24e6-e2c3-be97-275f9d0fe695@BlueTreble.com
обсуждение исходный текст
Ответ на Any reasons for 'DO' statement not returning result?  (Xtra Coder <xtracoder@gmail.com>)
Список pgsql-general
On 8/8/16 7:25 PM, Xtra Coder wrote:
> With some former experience with MsSQL server, where 'complex' script is
> executed easily and straightforward without any 'wrapping', like this
> dummy-one ...
>
>     DECLARE @a int;
>     DECLARE @b int;
>     ...
>     select @a + @b as "a+b"
>
> ... every time I need to execute some one-time-through-away complex code
> in PostgreSQL which returns rowset I'm disappointed - this has to be
> wrapped into normal 'temp' function which I have to delete all the time
> in current session, thus making an anonymous 'DO' statement use-less in
> 95% of my use-cases.
>
> So ... may someone know good reasons for such inconvenient design of
> 'DO' statement?

I don't recall why DO was designed that way, but I created
http://pgxn.org/dist/pg_lambda/ to do what you're looking for.
Unfortunately it's not quite as convenient as DO, and you also must
ALWAYS provide at least one correctly typed input (even if it's NULL) so
the pseudotype will work.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)   mobile: 512-569-9461


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: plpython.h not installed in 9.4
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Jsonb extraction very slow