Thread: BUG #4704: syntax error at or near "RETURNING"
The following bug has been logged online: Bug reference: 4704 Logged by: Brad Constantinescu Email address: brad.constantinescu@gmail.com PostgreSQL version: 8.1.4 Operating system: FreeBSD Description: syntax error at or near "RETURNING" Details: This is how the table looks like: CREATE TABLE orase ( id serial NOT NULL, judet_id bigint NOT NULL, nume character varying(256), nr_sectoare numeric(2), CONSTRAINT orase_pk PRIMARY KEY (id) ) WITH OIDS; ALTER TABLE orase OWNER TO erp; This is my code: INSERT INTO orase (id, nume, judet_id, nr_sectoare) VALUES (DEFAULT,'Medias', 34, 0) RETURNING id; This is the error I get: ERROR: syntax error at or near "RETURNING" LINE 3: RETURNING id; ^ ********** Error ********** ERROR: syntax error at or near "RETURNING" SQL state: 42601 Character: 92
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Brad Constantinescu wrote: > > This is my code: > INSERT INTO orase (id, nume, judet_id, nr_sectoare) > VALUES (DEFAULT,'Medias', 34, 0) > RETURNING id; > if you see the help , there is no term Returning in PG 8.1,see below postgres=# \h insert Command: INSERT Description: create new rows in a table Syntax: INSERT INTO table [ ( column [, ...] ) ] { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) | query } postgres=# select version(); version - ----------------------------------------------------------------------------------------------------- PostgreSQL 8.1.15 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42) (1 row) postgres=# -- regards,tushar http://webeatoracle.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFJu7TvfQNodY2PIRoRApquAJ0UefzDYcpAhZ3wGrzEGn8VdIcplwCfTAFG OfuWnNy4Sl0l2eux5WumZFQ= =aBh8 -----END PGP SIGNATURE-----
Hello it's not bug, 8.1 doesn't support RETURNING clause http://www.postgresql.org/docs/8.1/static/sql-insert.html please, upgrade to current stable release (8.3) regards Pavel Stehule 2009/3/14 Brad Constantinescu <brad.constantinescu@gmail.com>: > > The following bug has been logged online: > > Bug reference: =C2=A0 =C2=A0 =C2=A04704 > Logged by: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Brad Constantinescu > Email address: =C2=A0 =C2=A0 =C2=A0brad.constantinescu@gmail.com > PostgreSQL version: 8.1.4 > Operating system: =C2=A0 FreeBSD > Description: =C2=A0 =C2=A0 =C2=A0 =C2=A0syntax error at or near "RETURNIN= G" > Details: > > This is how the table looks like: > > CREATE TABLE orase > ( > =C2=A0id serial NOT NULL, > =C2=A0judet_id bigint NOT NULL, > =C2=A0nume character varying(256), > =C2=A0nr_sectoare numeric(2), > =C2=A0CONSTRAINT orase_pk PRIMARY KEY (id) > ) > WITH OIDS; > ALTER TABLE orase OWNER TO erp; > > This is my code: > INSERT INTO orase (id, nume, judet_id, nr_sectoare) > VALUES (DEFAULT,'Medias', 34, 0) > =C2=A0RETURNING id; > > This is the error I get: > > ERROR: =C2=A0syntax error at or near "RETURNING" > LINE 3: =C2=A0RETURNING id; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^ > > ********** Error ********** > > ERROR: syntax error at or near "RETURNING" > SQL state: 42601 > Character: 92 > > -- > Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-bugs >