Re: Error when selecting rows from a temporary table in ODBC

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Error when selecting rows from a temporary table in ODBC
Дата
Msg-id 7349.985234300@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Error when selecting rows from a temporary table in ODBC  (Hiroshi Inoue <Inoue@tpf.co.jp>)
Список pgsql-sql
Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> Ligia Pimentel wrote:
>> conn=57295424, query='drop table tmp_cr; drop table tmp_db; select
>> sum(valor) as totalCR, count(correlativo) as docsCR, caja into tmp_cr from
>> transaccion as t, codigocaja as c where c.codigo = t. codigo and c.tipomov =
>> 'CR' group by caja; select sum(valor) as totalDB, count(correlativo) as
>> docsDB, caja into tmp_db from transaccion t, codigocaja c where c.codigo =
>> t. codigo and c.tipomov = 'DB' group by caja; select db.caja, totalcr,
>> totaldb, docsdb, docscr from tmp_db db, tmp_cr cr where cr.caja = db.caja; '

> Seems a chained query is issued.
> Queries in a chained query are parse and analyzed all
> together before the chained query's execution. Therefore
> SELECT couldn't see tables which didn't exist before
> the execution.

More to the point, the later SELECTs are probably being parsed with
regard to the previous versions of tmp_cr and tmp_db that existed at
the start of the line.

This is fixed in 7.1, but in previous releases you'd best split up
that sequence of operations into multiple query submissions.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Maybe a Bug, maybe bad SQL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: FULL JOIN