Schema.Table.Col resolution seems broken in Alpha5

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Schema.Table.Col resolution seems broken in Alpha5
Date: 2010-04-27 22:32:29
Message-ID: 4BD765FD.3050300@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

It appears that something broke the ability to refer to columns by full
SQL path names in 9.0. That is, references to columns as
schema.table.col will produce a completely bogus error which did not
exist on previous versions.

The following works perfectly well in 8.4:

postgres=# create table test1( id serial, val integer );
NOTICE: CREATE TABLE will create implicit sequence "test1_id_seq" for
serial column "test1.id"
CREATE TABLE
postgres=# create table test2( id serial, val integer );
NOTICE: CREATE TABLE will create implicit sequence "test2_id_seq" for
serial column "test2.id"
CREATE TABLE
postgres=# insert into test1(val) select gs.i from generate_series(1,10)
as gs(i);
INSERT 0 10
postgres=# insert into test2(val) select gs.i from generate_series(1,10)
as gs(i);
INSERT 0 10
postgres=# select test1.* from public.test1, public.test2 where
public.test1.id = public.test2.id;
id | val
----+-----
1 | 1
2 | 2
3 | 3
4 | 4
5 | 5
6 | 6
7 | 7
8 | 8
9 | 9
10 | 10
(10 rows)

postgres=# update public.test1 set val=public.test2.val from
public.test2 where public.test1.id = public.test2.id;
UPDATE 10

However, it breaks in 9.0a5:

postgres=# create table test1( id serial, val integer );
NOTICE: CREATE TABLE will create implicit sequence "test1_id_seq" for
serial column "test1.id"
CREATE TABLE
postgres=# create table test2( id serial, val integer );
NOTICE: CREATE TABLE will create implicit sequence "test2_id_seq" for
serial column "test2.id"
CREATE TABLE
postgres=# insert into test1(val) select gs.i from generate_series(1,10)
as gs(i);
INSERT 0 10
postgres=# insert into test2(val) select gs.i from generate_series(1,10)
as gs(i);
INSERT 0 10
postgres=# select test1.* from public.test1, public.test2 where
public.test1.id = public.test2.id;
ERROR: invalid reference to FROM-clause entry for table "test1"
LINE 1: ...ect test1.* from public.test1, public.test2 where public.tes...
^
HINT: There is an entry for table "test1", but it cannot be referenced
from this part of the query.
postgres=# select public.test1.* from public.test1, public.test2 where
public.test1.id = public.test2.id;
ERROR: invalid reference to FROM-clause entry for table "test1"
LINE 1: select public.test1.* from public.test1, public.test2 where ...
^
HINT: There is an entry for table "test1", but it cannot be referenced
from this part of the query.
postgres=#

--
-- Josh Berkus
PostgreSQL Experts Inc.
http://www.pgexperts.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Fowler 2010-04-27 22:42:06 XML Todo List
Previous Message Tom Lane 2010-04-27 22:08:29 Re: testing HS/SR - 1 vs 2 performance