| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Rodriguez Fernando <rodriguez(at)ort(dot)edu(dot)uy> |
| Cc: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: column check mistake or not? |
| Date: | 2011-05-09 14:00:29 |
| Message-ID: | 28883.1304949629@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Rodriguez Fernando <rodriguez(at)ort(dot)edu(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | pedro mg | 2011-05-09 18:07:25 | BUG #6017: COPY from CSV file, WITH CSV HEADER fields order not respected |
| Previous Message | asuffield | 2011-05-09 13:03:05 | BUG #6016: Documentation makes inappropriate reference to boolean logic |