Re: wrong query result

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: wrong query result
Дата
Msg-id 47FC7F33.4040405@archonet.com
обсуждение исходный текст
Ответ на wrong query result  ("josep porres" <jmporres@gmail.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: "josep porres"
Дата:
Сообщение: wrong query result
Следующее
От: "Andrus"
Дата:
Сообщение: select statement fails