From: Marcin Stępnicki <mstepnicki@gmail.com>
To: Daniel Caune <daniel.caune@ubisoft.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL stored function inserting and returning data in a row.
Date: Fri, 11 Jan 2008 12:15:00 +0100
Message-ID: <179149fe0801110315w24bd1da8lcdd13c8875265f40@mail.gmail.com> (raw)
In-Reply-To: <1E293D3FF63A3740B10AD5AAD88535D206F416D1@UBIMAIL1.ubisoft.org>
References: <1E293D3FF63A3740B10AD5AAD88535D206F416D1@UBIMAIL1.ubisoft.org>
On Jan 11, 2008 4:23 AM, Daniel Caune <daniel.caune@ubisoft.com> wrote:
> Hi,
>
> Is there any way to define a SQL stored function that inserts a row in a
> table and returns the serial generated?
Maybe you just need INSERT ... RETURNING?
http://www.postgresql.org/docs/8.2/interactive/sql-insert.html
" Insert a single row into table distributors, returning the sequence
number generated by the DEFAULT clause:
INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets')
RETURNING did;
"
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mstepnicki@gmail.com, daniel.caune@ubisoft.com
Subject: Re: SQL stored function inserting and returning data in a row.
In-Reply-To: <179149fe0801110315w24bd1da8lcdd13c8875265f40@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox