[GENERAL] query with table alias

2004-11-12 Thread Rodríguez Rodríguez, Pere
Title: query with table alias Hello, I think I have found a query problem when the query has an alias for a table and use alias item and table name. I ilustrate the problem with a simple table and query. prr=# create table foo (c1 int2, c2 int2); CREATE TABLE prr=# insert into foo

Re: [GENERAL] query with table alias

2004-11-12 Thread Michael Glaesemann
On Nov 12, 2004, at 7:48 PM, Rodríguez Rodríguez, Pere wrote: prr=# select foo.c1, f.c2 from foo f;  -- Incorrect result  c1 | c2 +   1 |  1   2 |  1   1 |  2   2 |  2 (4 filas) If you alias a table, you can only reference the table using the alias. It is in effect renamed: foo is no

Re: [GENERAL] query with table alias

2004-11-12 Thread Patrick Fiche
: [GENERAL] query with table alias Hello, I think I have found a query problem when the query has an alias for a table and use alias item and table name. I ilustrate the problem with a simple table and query. prr=# create table foo (c1 int2, c2 int2); CREATE TABLE prr=# inser

Re: [GENERAL] query with table alias

2004-11-12 Thread Matteo Beccati
prr=# select foo.c1, f.c2 from foo f; -- Incorrect result The result of the select foo.c1, f.c2 from foo f isn't correct, it do a cartesian product of foo table. foo is aliased to f, so there's no table named foo in the from clause. By default postgres tries to add the missing table name, so