Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E77061337B71 for ; Fri, 29 Oct 2010 14:48:27 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 89436-03 for ; Fri, 29 Oct 2010 17:48:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id DC44E1337B63 for ; Fri, 29 Oct 2010 14:48:19 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o9THmIhS004481; Fri, 29 Oct 2010 13:48:18 -0400 (EDT) To: Jon Nelson cc: pgsql-performance@postgresql.org Subject: Re: typoed column name, but postgres didn't grump In-reply-to: References: Comments: In-reply-to Jon Nelson message dated "Fri, 29 Oct 2010 11:40:24 -0500" Date: Fri, 29 Oct 2010 13:48:18 -0400 Message-ID: <4480.1288374498@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/583 X-Sequence-Number: 41001 Jon Nelson writes: > Initially, I mis-typed the query, and one of the columns specified in > the query doesn't exist, however the query ran nonetheless. > The actual query: > select gid from t2, t3 where t2.name = t3.name and t3.scope = 'city' > and t3.hierarchy = 'STANDARD' and t2.adiv = t3.adiv limit 1 ; > However, there *is* no column 'name' in table 't2'. This is the old automatic-cast-from-record-to-text-string issue, ie it treats this like "(t2.*)::name". We've been over this a few times before, but it's not clear that we can make this throw an error without introducing unpleasant asymmetry into the casting behavior, as in you couldn't get the cast when you did want it. BTW this seems pretty far off-topic for pgsql-performance. regards, tom lane