INSERT DELETE RETURNING - Mailing list pgsql-sql

From Phillip Smith
Subject INSERT DELETE RETURNING
Date
Msg-id 008201c7198a$93ad5520$9b0014ac@wbaus090
Whole thread Raw
List pgsql-sql

Hi All,

 

As per Daniel Caune’s posting (with no replies) on October 22nd, (http://archives.postgresql.org/pgsql-sql/2006-10/msg00195.php), Can I do this…?

 

INSERT INTO stock_deleted_tmp (

      code,

      description,

      date_deleted

      )

      DELETE FROM ONLY stock_tmp

      WHERE grp = '0001'

      RETURNING code, description, current_timestamp

 

At the moment I’m getting this error:

ERROR:  syntax error at or near "DELETE"

LINE 6: DELETE FROM ONLY stock_tmp

 

Yes I have upgraded to PG 8.2:

horseland=# DELETE FROM ONLY stock_tmp WHERE grp = '0001' RETURNING code, description, current_timestamp;

  code  |             description              |              now

--------+--------------------------------------+-------------------------------

 920687 | DEBRISOL 500ML                       | 2006-12-07 09:57:37.434605+11

 460950 | ROMA BASIC BUZZ OFF F/MSK SND/BRN S  | 2006-12-07 09:57:37.434605+11

 460951 | ROMA BASIC BUZZ OFF F/MSK SND/BRN M  | 2006-12-07 09:57:37.434605+11

 460952 | ROMA BASIC BUZZ OFF F/MSK SND/BRN L  | 2006-12-07 09:57:37.434605+11

 460953 | ROMA BASIC BUZZ OFF F/MSK SND/BRN XL | 2006-12-07 09:57:37.434605+11

 402832 | COMB PLASTIC BALL BLK                | 2006-12-07 09:57:37.434605+11

(6 rows)

     

DELETE 6

horseland=#

 

Thanks,

-p

 

Phillip Smith
IT Coordinator
Weatherbeeta P/L
8 Moncrief Rd
Nunawading, VIC, 3131
AUSTRALIA


*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to the addressee. If you are not the addressee indicated in this message or responsible for delivery of the message to such person, you may not copy or deliver this message to anyone, and you should destroy it and kindly notify the sender by reply email.

Information in this message that does not relate to the official business of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta. Weatherbeeta, its employees, contractors or associates shall not be liable for direct, indirect or consequential loss arising from transmission of this message or any attachments

pgsql-sql by date:

Previous
From: "Rajesh Kumar Mallah"
Date:
Subject: Re: Proper way of iterating over the column names in a trigger function. [ SOLVED]
Next
From: Thomas Pundt
Date:
Subject: Re: Query is fast and function is slow