Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 434BE1337B93 for ; Wed, 9 Feb 2011 10:25:26 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 42573-08 for ; Wed, 9 Feb 2011 14:25:20 +0000 (UTC) X-Greylist: delayed 00:16:15.561189 by SQLgrey-1.7.6 Received: from smtp.domeneshop.no (smtp.domeneshop.no [194.63.248.54]) by mail.postgresql.org (Postfix) with ESMTP id 46EDC1337B83 for ; Wed, 9 Feb 2011 10:25:18 -0400 (AST) Received: from [194.237.103.55] (helo=charliex.local) by smtp.domeneshop.no with esmtpa (Exim 4.72) (envelope-from ) id 1PnAj7-0004RC-16; Wed, 09 Feb 2011 15:09:01 +0100 Message-ID: <4D529FE8.2070800@blogg.se> Date: Wed, 09 Feb 2011 15:08:40 +0100 From: =?UTF-8?B?Um9iZXJ0IEdyYXZzasO2?= User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: kaloyan@digsys.bg CC: pgsql-general@postgresql.org Subject: Re: Possible Bug References: <4D5263AA.9050807@digsys.bg> In-Reply-To: <4D5263AA.9050807@digsys.bg> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201102/359 X-Sequence-Number: 172625 On 2011-02-09 10.51, Kaloyan Iliev Iliev wrote: > Hi, > I think I found something strange in PostgreSQL behavior. Here is an > example: > > > testdb=# CREATE TABLE test1 (test2 text, test3 text); > CREATE TABLE > testdb=# SELECT A.name FROM test1 A; > name > ------ > (0 rows) > > testdb=# INSERT INTO test1 (test2,test3) VALUES ('1','2'); > INSERT 0 1 > testdb=# INSERT INTO test1 (test2,test3) VALUES ('3','4'); > INSERT 0 1 > testdb=# SELECT A.name FROM test1 A; > name ------- > (1,2) > (3,4) > (2 rows) > > customer.20080408=# SELECT name FROM test1; > ERROR: column "name" does not exist > LINE 1: SELECT name FROM test1; > > > testdb=# SELECT version(); > version > ---------------------------------------------------------------------------------------------------------- > > PostgreSQL 8.4.5 on amd64-portbld-freebsd8.1, compiled by GCC cc (GCC) > 4.2.1 20070719 [FreeBSD], 64-bit > (1 row) > > Obviously there is no column with name "name", but the SELECT query > (ONLY WHEN I USE ALIASES) returns result for it. > And if I have a column with name "name_en" and by mistake write it > "name", instead of error I receive strange data (ARRAY from all > columns), that I don't expect. > > Could you tell me if this is a bug or some feature I haven't heard of. Look up functional notation in http://www.postgresql.org/docs/9.0/static/xfunc-sql.html#AEN46042 These are the same thing: select name(test1) from test1; select test.name from test1; > > Best regards, > Kaloyan Iliev > > > -- Regards, Robert "roppert" Gravsjö