Using RETURNING with INTO inside pgsql
| От | D. Dante Lorenso |
|---|---|
| Тема | Using RETURNING with INTO inside pgsql |
| Дата | |
| Msg-id | 46F352B6.9040203@lorenso.com обсуждение исходный текст |
| Ответы |
Re: Using RETURNING with INTO inside pgsql
Re: Using RETURNING with INTO inside pgsql |
| Список | pgsql-general |
Not really a question here, I just wanted to share my joy with the
group. I'm loving the new RETURNING clause in PostgreSQL. This is
really cool stuff ...
-------------------- 8< --------------------
CREATE OR REPLACE FUNCTION "public"."testfunc" () RETURNS bigint AS
$body$
DECLARE
my_var BIGINT;
BEGIN
INSERT INTO tryit (col1, col2)
VALUES ('a', 'b')
RETURNING prikey
INTO my_var;
RETURN my_var;
END;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
-------------------- 8< --------------------
I never do anything this trivial inside a stored proc, but the point is
not what I'm doing but rather how it's done. That RETURNING clause
really helps reduce the amount of SQL I have to write. PostgreSQL 8.2.4
rocks!
-- Dante
В списке pgsql-general по дате отправления: