pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Phillip Smith <phillips@weatherbeeta.com.au>
To: pgsql-sql@postgresql.org
Subject: INSERT DELETE RETURNING
Date: Thu, 7 Dec 2006 10:02:16 +1100
Message-ID: <008201c7198a$93ad5520$9b0014ac@wbaus090> (raw)

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

Message-ID: <008201c7198a$93ad5520$9b0014ac@wbaus090>
Permalink:  ../008201c7198a$93ad5520$9b0014ac@wbaus090/
Also on:    postgresql.org/message-id/008201c7198a$93ad5520$9b0014ac@wbaus090

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: phillips@weatherbeeta.com.au
  Subject: Re: INSERT DELETE RETURNING
  In-Reply-To: <008201c7198a$93ad5520$9b0014ac@wbaus090>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox