X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id CDF369FA5E9 for ; Wed, 31 May 2006 18:35:14 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 80911-04 for ; Wed, 31 May 2006 18:35:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from titan.startnet.cz (unknown [82.113.63.73]) by postgresql.org (Postfix) with ESMTP id DB63B9FA5E1 for ; Wed, 31 May 2006 18:34:57 -0300 (ADT) Received: (qmail 5077 invoked from network); 31 May 2006 23:34:52 +0200 Received: from unknown (HELO ?192.168.1.200?) (miroslav.sulc@startnet.cz@10.15.192.25) by titan.local.startnet.cz with ESMTPA; 31 May 2006 23:34:52 +0200 Message-ID: <447E0BF3.2040707@startnet.cz> Date: Wed, 31 May 2006 23:34:43 +0200 From: =?ISO-8859-2?Q?Miroslav_=A9ulc?= Organization: StartNet s.r.o. User-Agent: Thunderbird 1.5.0.2 (X11/20060501) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: DELETE ... USING ... - 8.0 and 8.1 compatibility problem Content-Type: multipart/mixed; boundary="------------060108050802070007090508" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/204 X-Sequence-Number: 25235 This is a multi-part message in MIME format. --------------060108050802070007090508 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit Hello, I have an SQL DELETE command that selects the items that should be deleted against two large sets of data. This is the query: DELETE FROM MRTPQuotaItem_MRTPContact USING MRTPQuotaItem, MRTPQuota, MRTPContact WHERE (MRTPQuotaItemId = MRTPQuotaItem.Id AND MRTPQuotaItem.MRTPQuotaId = MRTPQuota.Id AND MRTPQuota.MRTPWaveQuestionnaireId = 1) AND (MRTPContactId = MRTPContact.Id AND MRTPContact.MRTPWaveQuestionnaireId != 1) The problem is that I have application deployed both on pg 8.0 and pg 8.1. This syntax (using USING) is only valid for 8.1+ and syntax without USING is only valid for 8.0 and not for 8.1. I could write it using IN operators which works in both versions but the slowdown is not acceptable. Is there a way to write the command so that both versions of pg accept it and not to use IN operator which unacceptably slows the thing down in this case? Thank you for any suggestion. -- Miroslav Šulc --------------060108050802070007090508 Content-Type: text/x-vcard; charset=utf-8; name="miroslav.sulc.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="miroslav.sulc.vcf" begin:vcard fn;quoted-printable:Miroslav =C5=A0ulc n;quoted-printable:=C5=A0ulc;Miroslav org:StartNet s.r.o. adr;quoted-printable;quoted-printable:;;Schodov=C3=A1 309/10;Praha 5;;150 00;=C4=8Cesk=C3=A1 republika email;internet:miroslav.sulc@startnet.cz tel;cell:+420 603 711 413 x-mozilla-html:TRUE url:http://www.startnet.cz version:2.1 end:vcard --------------060108050802070007090508--