From: | "Patrick Hatcher" <PHatcher(at)macys(dot)com> |
---|---|
To: | "Ravinder Bhalla <Ravinder(dot)Bhalla" <Ravinder(dot)Bhalla(at)ipix(dot)com> |
Cc: | sfpug(at)postgresql(dot)org, sfpug-owner(at)postgresql(dot)org |
Subject: | Re: Bug or expected behaviour |
Date: | 2003-12-15 20:47:06 |
Message-ID: | OFCF07E60F.15C3A567-ON88256DFD.007185A1-88256DFD.0072D673@fds.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | sfpug |
Betcha PG added the FROM clause for the EMP table automatically for you. I
ran into this when I first started using PG. In version 7.4 you can set
the conf file to not allow these types of non-explicit FROM clauses. I'm
not sure there's a way not to allow this in earlier versions
Patrick Hatcher
Macys.Com
Ravinder Bhalla
<Ravinder(dot)Bhalla(at)ip
ix.com> To
Sent by: sfpug(at)postgresql(dot)org
sfpug-owner(at)postgre cc
sql.org
Subject
[sfpug] Bug or expected behaviour
12/12/2003 11:24 AM
Could someone pls explain me the following,
I have two table tables emp and dept
emp
----------
empid
empname
dept_no
age
dept
----------
deptid
deptname
billdb=# select * from dept\g
deptid | deptname
--------+----------
100 | Oracle
200 | PHP
(2 rows)
billdb=# select * from emp;
empid | empname | dept_no | age
-------+---------+---------+-----
1 | Abhay | 100 | 24
2 | AB | 200 | 26
(2 rows)
billdb=# select * from emp where empid in ( select empid from dept);
empid | empname | dept_no | age
-------+---------+---------+-----
1 | Abhay | 100 | 24
2 | AB | 200 | 26
(2 rows)
Why the query is returning rows when empid column doesn't exists in dept
table. Should throw an error.
Thanks
Ravinder
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2003-12-15 22:20:44 | Re: Bug or expected behaviour |
Previous Message | Ravinder Bhalla | 2003-12-12 19:24:56 | Bug or expected behaviour |