Search Postgresql Archives

Re: wrong query result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



josep porres wrote:
select clau, lecact-lecant as m3, m3any, ta, tc, 3 as mesos, persones, true
as clavegueram
from fac_abonats
where clau in (select clau from tmp_claus_prova)
order by clau

At the end I've realized that there is no column named 'clau'. It has
another name.

The question is:
Is it a normal behaviour? Because I think that if the query is wrong,
wouldn't be better to raise an error?

It's not an error, you need to be able to refer to columns in the outer query so you can do:
...(SELECT x FROM tmp_claus_prova WHERE y = clau)

It *is* confusing where you have a typo though. It gets everyone from time to time.

--
  Richard Huxton
  Archonet Ltd


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux