The following bug has been logged online: Bug reference: 3320 Logged by: Jan Szumiec Email address: [EMAIL PROTECTED] 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 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match