Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 5C2FD9F9CB8 for ; Wed, 6 Dec 2006 19:03:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 11136-09 for ; Wed, 6 Dec 2006 19:02:48 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from weatherbeeta.com.au (218-214-212-153.people.net.au [218.214.212.153]) by postgresql.org (Postfix) with SMTP id C8E7F9FA274 for ; Wed, 6 Dec 2006 19:02:46 -0400 (AST) Received: (qmail 5914 invoked from network); 6 Dec 2006 23:02:43 -0000 X-NetworkBox-HamSign: 0101;OUT;wbeetaau1;5451022b5e6294ad0dd83fa444afa6a3; Received: from mail.weatherbeeta.com.au (HELO SRV-Email) (172.20.0.2)by network-box.weatherbeeta.com.au with SMTP; 6 Dec 2006 23:02:43 -0000 Received: from it-phil.weatherbeeta.com.au ([172.20.0.155]) by SRV-Email (602Pro LAN SUITE 2003) id 2d62ec6b for pgsql-sql@postgresql.org; Thu, 7 Dec 2006 10:02:17 +1100 Reply-To: From: "Phillip Smith" To: Subject: INSERT DELETE RETURNING Date: Thu, 7 Dec 2006 10:02:16 +1100 Message-ID: <008201c7198a$93ad5520$9b0014ac@wbaus090> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0083_01C719E6.C71DCD20" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 Importance: Normal X-Scanned-By-wbeetaau1: Virus scan performed by network-box X-Scanned-By-wbeetaau1: Scanner file id is wbeetaau1-1165446163.7-5909-000 X-Scanned-By-wbeetaau1: No known viruses found in message (received+scanned in 0.04/0.13 secs) X-Scanned-By-wbeetaau1: Spam-Check-Result: No, hits=0 required=7 tests= autolearn=no version=2.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.454 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO, HTML_MESSAGE, SUBJ_ALL_CAPS, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200612/72 X-Sequence-Number: 27028 This is a multi-part message in MIME format. ------=_NextPart_000_0083_01C719E6.C71DCD20 Content-Type: text/plain;charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi All, =20 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.? =20 INSERT INTO stock_deleted_tmp ( code, description, date_deleted ) DELETE FROM ONLY stock_tmp WHERE grp =3D '0001' RETURNING code, description, current_timestamp =20 At the moment I'm getting this error: ERROR: syntax error at or near "DELETE" LINE 6: DELETE FROM ONLY stock_tmp =20 Yes I have upgraded to PG 8.2: horseland=3D# DELETE FROM ONLY stock_tmp WHERE grp =3D '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) =20 DELETE 6 horseland=3D# =20 Thanks, -p =20 Phillip Smith IT Coordinator Weatherbeeta P/L 8 Moncrief Rd Nunawading, VIC, 3131 AUSTRALIA=20 *******************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 ------=_NextPart_000_0083_01C719E6.C71DCD20 Content-Type: text/html;charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi All,

 

As per Daniel Caune’s posting (with no replies) = on October 22nd, (ht= tp://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 =3D = '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=3D# = DELETE FROM ONLY stock_tmp WHERE grp =3D '0001' RETURNING code, description, = current_timestamp;

  code  = |            = description          &n= bsp;   |            =   now

--------+--------------------------------------+-------------------= ------------

 920687 | = DEBRISOL 500ML           &n= bsp;           | 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           &nbs= p;    | 2006-12-07 09:57:37.434605+11

(6 = rows)

      =

DELETE = 6

horseland=3D#

 

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
------=_NextPart_000_0083_01C719E6.C71DCD20--