From: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
---|---|
To: | erobles <erobles(at)sensacd(dot)com(dot)mx> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: using querys like: 'select table.*' |
Date: | 2009-12-03 03:12:50 |
Message-ID: | 4B172CB2.5070503@postnewspapers.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 3/12/2009 7:58 AM, erobles wrote:
> Hi!
>
> In postgresql 7.2 i can use this kind of querys:
>
> select table.* ;
>
> select * from table1 where table1.key=othertable.key;
>
>
> but in postgresql 8.3 i have an error like this:
> ERROR: missing FROM-clause entry for table ...
>
>
> what should i do to solve this? :-)
You've already been pointed to the workaround backward-compat option.
What's happening here is that you're doing an implicit inner join. Your
query is being interpreted by PostgreSQL as if you wrote:
select * from table1, othertable where table1.key=othertable.key;
though I prefer to write it as the IMO more readable:
select * from table1 INNER JOIN othertable ON table1.key=othertable.key;
This behaviour isn't supported anymore partly is because it's way too
easy to write:
select * from table1 where table1.key=typotable.key;
and get confusing error messages or, if `typotable' exists, confusing
query results. I'm pretty sure there were more reasons too, but I wasn't
really active on the lists when that was going on.
It's also really confusing when reading a query.
So - as already pointed out, you will need to re-write your queries to
add the required tables to the from clause.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2009-12-03 03:28:18 | Re: Catastrophic changes to PostgreSQL 8.4 |
Previous Message | Jerome Alet | 2009-12-03 03:09:29 | Re: [Bacula-users] Catastrophic changes to PostgreSQL 8.4 |