INSERT doc discrepancy

From: Kristo Kaiv <kristo(dot)kaiv(at)skype(dot)net>
To: Postgres-General List <pgsql-general(at)postgresql(dot)org>
Subject: INSERT doc discrepancy
Date: 2007-08-28 12:22:35
Message-ID: 2F77DB50-6007-4CB4-9C78-6945B8BAF5D5@skype.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

INSERT INTO table [ ( column [, ...] ) ]
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] )
[, ...] | query }
[ RETURNING * | output_expression [ AS output_name ] [, ...] ]

but it seems if i want to return the result into a record i have to
use it with INTO clause in the end:

INSERT INTO tablename (
a
,b
,c
) VALUES (
in_a
,in_b
,in_c
) RETURNING * INTO _r;

using either

INSERT INTO tablename (
a
,b
,c
) VALUES (
in_a
,in_b
,in_c
) RETURNING _r;

or

INSERT INTO tablename (
a
,b
,c
) VALUES (
in_a
,in_b
,in_c
) RETURNING * AS _r;

didn't work on PostgreSQL 8.2.4

Kristo Kaiv
http://kaiv.wordpress.com (PostgreSQL blog)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kamil Srot 2007-08-28 12:23:00 Re: One database vs. hundreds?
Previous Message Kynn Jones 2007-08-28 12:08:36 One database vs. hundreds?