Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 6A1189FBA7A for ; Sun, 1 Jul 2007 15:44:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 45533-06 for ; Sun, 1 Jul 2007 15:44:48 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.176]) by postgresql.org (Postfix) with ESMTP id 6C5C39FBA1F for ; Sun, 1 Jul 2007 15:44:49 -0300 (ADT) Received: by wa-out-1112.google.com with SMTP id k40so2229095wah for ; Sun, 01 Jul 2007 11:44:48 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=hHkyMs0qJE8bG1ZY1dhb49VH/NxqFplxDowOuIzjdMM6jDzx6LaOI+OrLP7Gcw2yFix5VcqSbbrJ2vKTKnoTzRjvIpmyz3OfJieUZ1u93bqg2XkbLKB9oNDQrEMr3W5oAylDpjUDDhh99PAo30NC7RNNFdJrRE7r1htFrksT3JA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=ARIJeWca7OQJ0kiYMpWYk6gLAUS7TcqTdQOwCi+mbv/PEPWuZM7SZc6so5Ndb7QswhTeozS4QwQGQskp3fDM1DhFCcSdhtIaHQ/ajSA9zcLVZpOVWBATyKKVAKUrjd8gMciHBpEwrZ+P441YdxrQrvbaXcBgaCbbCp1kfR4ZyW4= Received: by 10.114.198.1 with SMTP id v1mr4437568waf.1183315487578; Sun, 01 Jul 2007 11:44:47 -0700 (PDT) Received: by 10.115.76.2 with HTTP; Sun, 1 Jul 2007 11:44:47 -0700 (PDT) Message-ID: <45b42ce40707011144t20c7703bk11328bdbd6e17a6f@mail.gmail.com> Date: Sun, 1 Jul 2007 19:44:47 +0100 From: "Harry Jackson" To: pgsql-general@postgresql.org Subject: Is this a bug? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/12 X-Sequence-Number: 116613 The following sql statement fails because the column "user_id" does not exist in the users table. =# select user_id from users WHERE username = 'blah'; ERROR: column "user_id" does not exist LINE 1: select user_id from users WHERE username = 'blah...... ^ The following shows a valid statement where I want to delete one user entry from the "map_users_roles" table =# delete from map_users_roles where user_id = (select id from users WHERE username = 'blah'); DELETE 2 If I made a mistake and changed the "id" column to "user_id" then from some the statement executes. =# delete from map_users_roles where user_id = (select user_id from users WHERE username = 'blah'); DELETE 33631 I would have thought that the last statement would fail. Instead it removed all the entries from the table. This is happening because I did not qualify the column names as follows... =# delete from map_users_roles where user_id = (select u.user_id from users as u WHERE username = 'blah'); ERROR: column u.user_id does not exist LINE 1: ...lete from map_users_roles where user_id = (select u.user_id ... Still, this was quite a suprise to me and I would consider this a bug. Thoughts? -- Harry http://www.uklug.co.uk http://www.hjackson.org