pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DELETE ... USING ... - 8.0 and 8.1 compatibility problem
2+ messages / 2 participants
[nested] [flat]

* DELETE ... USING ... - 8.0 and 8.1 compatibility problem
@ 2006-05-31 21:34  Miroslav Šulc <miroslav.sulc@startnet.cz>
  0 siblings, 1 reply; 2+ messages in thread

From: Miroslav Šulc @ 2006-05-31 21:34 UTC (permalink / raw)
  To: pgsql-sql

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

Attachments:

miroslav.sulc.vcf (text/x-vcard, 347B) download 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
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: DELETE ... USING ... - 8.0 and 8.1 compatibility problem
@ 2006-05-31 21:50  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Miroslav Šulc <miroslav.sulc@startnet.cz>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2006-05-31 21:50 UTC (permalink / raw)
  To: Miroslav Šulc <miroslav.sulc@startnet.cz>; +Cc: pgsql-sql

=?ISO-8859-2?Q?Miroslav_=A9ulc?= <miroslav.sulc@startnet.cz> writes:
> 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.

Set add_missing_from TRUE ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-05-31 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-31 21:34 DELETE ... USING ... - 8.0 and 8.1 compatibility problem Miroslav Šulc <miroslav.sulc@startnet.cz>
2006-05-31 21:50 ` Tom Lane <tgl@sss.pgh.pa.us>

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