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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general