From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rodriguez Fernando <rodriguez@ort.edu.uy>
Cc: pgsql-bugs@postgresql.org
Subject: Re: column check mistake or not?
Date: Mon, 09 May 2011 10:00:29 -0400
Message-ID: <28883.1304949629@sss.pgh.pa.us> (raw)
In-Reply-To: <4DC7D1D5.5070306@ort.edu.uy>
References: <4DC7D1D5.5070306@ort.edu.uy>
Rodriguez Fernando <rodriguez@ort.edu.uy> writes:
> Yesterday i did a mistake executing one query, i use a column daes not
> exists in the table the result was all rows of the table.
> Platform Fedora 14 32 bits
> Version Postgresql 9.0.2
> The column id_documento not exists in t_log_modificar_deuda, this
> behavior is correct or not?
> query
> select * from t_documento where (importe_deudor_documento >
> importe_documento) or id_documento in (select id_documento from
> t_log_modificar_deuda);
> result all column of t_documento.
Yes, it is. That's an outer reference to the id_documento from
t_documento, so of course the IN will succeed (assuming id_documento
isn't null and there's at least one row in t_log_modificar_deuda).
Outer references are a SQL feature that bites novices fairly often :-(
but on the other hand sub-selects would be far less useful without them.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, rodriguez@ort.edu.uy
Subject: Re: column check mistake or not?
In-Reply-To: <28883.1304949629@sss.pgh.pa.us>
References: <4DC7D1D5.5070306@ort.edu.uy> <28883.1304949629@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