Is there anything like a macro or an inline table valued function in postgres?
i.e I define a query as a function/macro and reuse the function in queries and
the dbms will expand the function/macro to its definition, thus avoiding any
overhead.
If not what is the closest thing?
Thanks
Thanks
Any solution without cursors perhaps?
From: hubert depesz lubaczewski
To: Bret Green
Cc: pgsql-general@postgresql.org
Sent: Sun, September 19, 2010 7:12:51 AM
Subject: Re: [GENERAL] how to insert multiple rows and get the ids back in a
temp table
No I do need it inside pgplsql. I need pgplsql for other stuff.
From: Alban Hertroys
To: Bret Green
Cc: pgsql-general@postgresql.org
Sent: Sun, September 19, 2010 9:25:46 AM
Subject: Re: [GENERAL] how to insert multiple rows and get the ids back in a
temp
how can I do the following in plpgsql?
insert multiple rows in a table
get the ids (serial) into a temp table (not the client)
for one row it will be like this
insert into mytable(mycolumn)values(123)returning id into some_variable;
now for multiple rows (using insert select) it will be like
i