Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ys5Px-0006Kb-FX for pgsql-bugs@arkaria.postgresql.org; Tue, 12 May 2015 08:19:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ys5Pw-0007zs-BS for pgsql-bugs@arkaria.postgresql.org; Tue, 12 May 2015 08:19:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Ys5Pv-0007zl-Cq for pgsql-bugs@postgresql.org; Tue, 12 May 2015 08:19:55 +0000 Received: from mxl2.seznam.cz ([77.75.76.44]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Ys5Pn-0005pA-Tf for pgsql-bugs@postgresql.org; Tue, 12 May 2015 08:19:54 +0000 Received: from email.seznam.cz by email-smtpc1a.ng.seznam.cz (email-smtpc1a.ng.seznam.cz [10.23.10.15]) id 3712f027cecfa6ba373add68; Tue, 12 May 2015 10:19:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seznam.cz; s=beta; t=1431418784; bh=kah+Fjiz0YJpi7C0AFOwrf6o6IYigDcDR82HlSwyd+c=; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC: Subject:References:In-Reply-To:Content-Type: Content-Transfer-Encoding; b=GGbl64ranDCrVlx+lmWP+TSvo51yxZJ8tTECd587ckbQq+7oZHg0dF28mf/OjstNX G58bGQ1UIn3OIGjmpGVCjUcb8WWQbX52ekULT+LM6AUKiUPFSXZqLFg29mz35bSeIw YoCwrqB+u3WOt8T7bBOvCrBscWdQlJaiKDf7U13Q= Received: from [192.168.2.22] (64.100.broadband3.iol.cz [85.70.100.64]) by email-relay1.ng.seznam.cz (Seznam SMTPD 1.3.1) with ESMTP; Tue, 12 May 2015 10:19:42 +0200 (CEST) Message-ID: <5551B79B.9080005@seznam.cz> Date: Tue, 12 May 2015 10:19:39 +0200 From: =?UTF-8?B?VsOhY2xhdiBCcm9kZWM=?= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Thomas Munro CC: PostgreSQL Bugs Subject: Re: BUG #13273: A query that returns wrongly labeled result instead of syntax error References: <20150511224630.2714.40796@wrigleys.postgresql.org> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Thomas Munro writes: > On Tue, May 12, 2015 at 10:46 AM, wrote: >> The following bug has been logged on the website: >> >> Bug reference: 13273 >> Logged by: Missing comma in SELECT list results in wrong label without error >> Email address: v-brody@seznam.cz >> PostgreSQL version: 9.4.1 >> Operating system: CentOS Linux >> Description: >> >> Following query (notice the missing comma between top-level "x" and "y") >> returns 1 (which is "x" value) under label "y" without any warning. >> >> select >> "x" "y" >> from >> ( >> select >> "a" as "x", "b" as "y" >> from >> ( >> select 1 as "a", 2 as "b" >> ) "subquery1" >> ) "subquery2"; >> >> Expected behavior: syntax error > > That is valid syntax, the AS keyword is optional (in PostgreSQL as > well as in standard SQL): > > http://www.postgresql.org/docs/9.4/static/sql-select.html > > postgres=# select 42 as y; > y > ---- > 42 > (1 row) > > postgres=# select 42 y; > y > ---- > 42 > (1 row) > I'm really sorry, I realized that immediately after submitting. Although I think that demanding explicit AS in this case (when overshadowing some name) might be useful. :-) Thank you for your time, Václav Brodec -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs