Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 03D4C133740B for ; Thu, 2 Dec 2010 03:47:34 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 81200-05 for ; Thu, 2 Dec 2010 07:47:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtpcorp.com (smtpcorp.com [67.192.120.76]) by mail.postgresql.org (Postfix) with ESMTP id 3193E1335B36 for ; Thu, 2 Dec 2010 03:47:25 -0400 (AST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=main; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:Message-ID:Date:Subject:From:To; bh=cLdKUpnVjZZob+AHKvjTDQOOFyT4zsLSYgvD1I5D2Aw=; b=UMFvW5jteIZOG3IHws4fODLc6XRZH8KjnllE/K0mTvu6GdDsnZGY8cVPBBsPzfMGoJfuPstHNsFiqugpbEeZdeBZZE76QrKOIe/HqLn+rL4fZlofqRmGzxeAPxuenJZ4; Received: from ip-118-90-132-194.xdsl.xnet.co.nz ([118.90.132.194] helo=gonzo) by smtpcorp.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.70) id 1PO3sw-0006J5-MH; mid 144 for pgsql-sql@postgresql.org; Thu, 02 Dec 2010 07:47:23 +0000 Received: from news by gonzo with local (Exim 4.72) (envelope-from ) id 1PO3sj-0001kf-Oc for pgsql-sql@postgresql.org; Thu, 02 Dec 2010 20:47:09 +1300 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: DELETE WHERE EXISTS unexpected results Date: 2 Dec 2010 07:47:09 GMT Organization: Dis (not Dat) Organisation Lines: 17 Message-ID: References: NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reversiblemaps.ath.cx 1291276029 6454 127.0.0.1 (2 Dec 2010 07:47:09 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-18 (Linux) X-Smtpcorp-Track: 17357221.1.34383717 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_SORBS_DUL=0.001 X-Spam-Level: X-Archive-Number: 201012/9 X-Sequence-Number: 34845 On 2010-11-30, Jeff Bland wrote: > This is a multipart message in MIME format. > --=_alternative 007A6509852577EB_= > Content-Type: text/plain; charset="US-ASCII" > > I want to delete certain rows from table USER_TBL. > Two tables are involved. USER_TBL and OWNER_TBL. delete ... using was invented for this purpose. > In the end I expect the USER_TBL to not contain the 3 HOME entries. > But what is happening is the whole USER_TBL is empty after the query. your subselect is being effected by the table used in the delete. -- ⚂⚃ 100% natural