From: | Oliver Dizon <johnoliver(at)rtzassociates(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: |
Date: | 2015-01-28 02:03:14 |
Message-ID: | 1466245406.233187.1422410594679.JavaMail.root@mail |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Oliver Dizon <johnoliver(at)rtzassociates(dot)com> writes:
> Hi Guys,
> I hope I'm in the right place to throw this. I just want to ask the reason behind this weird scenario.
> All records were deleted in a table even if the subquery in the where clause has a missing a column.
> --from a certain script where table_id is not yet existing on table_sample
> delete from main_table_sample where table_id in (select table_id from table_sample);
> Im expecting that postgres will return an ERROR message like
> 'column "table_id" does not exist on table table_sample'
> Read up on "outer references" in SQL sub-selects. This query is entirely
> legal, although it doesn't do what you want.
> regards, tom lane
It is indeed an example of outer references. I guess I should used aliases for tables in constructing queries with sub-selects to avoid this instance.
Thanks!
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Dizon | 2015-01-28 02:07:51 | Re: (unknown) |
Previous Message | Jeremy Palmer | 2015-01-28 00:30:21 | Re: SSO Windows-to-unix |