pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
Cc: Ligia Pimentel <lmpimentel@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Error when selecting rows from a temporary table in ODBC
Date: Wed, 21 Mar 2001 23:11:40 -0500
Message-ID: <7349.985234300@sss.pgh.pa.us> (raw)
In-Reply-To: <3AB95868.AD204C08@tpf.co.jp>
References: <99ao69$25ul$1@news.tht.net>
	<3AB95868.AD204C08@tpf.co.jp>

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



view thread (3+ messages)

Message-ID: <7349.985234300@sss.pgh.pa.us>
Permalink:  ../7349.985234300@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7349.985234300@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Inoue@tpf.co.jp, lmpimentel@yahoo.com
  Subject: Re: Error when selecting rows from a temporary table in ODBC
  In-Reply-To: <7349.985234300@sss.pgh.pa.us>
  References: <99ao69$25ul$1@news.tht.net> <3AB95868.AD204C08@tpf.co.jp> <7349.985234300@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox