Skip site navigation (1) Skip section navigation (2)

BUG #3320: Error when using INSERT...RETURNING as a subquery

From: "Jan Szumiec" <jan(dot)szumie(at)infiniteloop(dot)eu>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3320: Error when using INSERT...RETURNING as a subquery
Date: 2007-05-29 11:27:05
Message-ID: 200705291127.l4TBR5g9040971@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      3320
Logged by:          Jan Szumiec
Email address:      jan(dot)szumie(at)infiniteloop(dot)eu
PostgreSQL version: 8.2.4
Operating system:   Windows XP
Description:        Error when using INSERT...RETURNING as a subquery
Details: 

Having:

CREATE TABLE efforts
(
  id serial NOT NULL,
  effort integer
) 
WITHOUT OIDS;

CREATE TABLE items
(
  id serial NOT NULL,
  "type" character varying(255),
  created_at timestamp without time zone,
  subject character varying(255),
  body text,
  effort integer,
  CONSTRAINT items_pkey PRIMARY KEY (id)
) 
WITHOUT OIDS;

executing the following query:

UPDATE items SET (type, post_id) = (INSERT INTO efforts (effort) VALUES
(667) RETURNING 'Item', id) WHERE id = 1937

produces this error:

ERROR: syntax error at or near "INTO"
SQL state:42601
Character:44

Responses

pgsql-bugs by date

Next:From: Richard HuxtonDate: 2007-05-29 11:50:48
Subject: Re: [HACKERS] exit
Previous:From: Marcos Fabrício CorsoDate: 2007-05-29 11:12:38
Subject: [HACKERS] exit

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group