Re: Query will execute when inner query have issue

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: selva kumar <selva(dot)logic(at)hotmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Query will execute when inner query have issue
Date: 2020-01-23 18:50:46
Message-ID: CAKFQuwZx=0T+P_kGJ38mCFHUwmkO8Mi4ow6ADZ5hMnsOkAFQaw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Jan 23, 2020 at 9:19 AM selva kumar <selva(dot)logic(at)hotmail(dot)com> wrote:

> But the following query will executed
>
> select * from product where productid in (select productid from sales
> where salesdate='2020-01-22')
>
>
>
Which isn't the same as what you first posted because of the absence of
table qualifications. That single difference, explained by Tom, completely
explains why the original post did in fact provoke and error and this query
does not.

The take-away is make sure to test your queries; and when dealing with
sub-queries its usually a good idea of add a table qualification to your
fields.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Roffey 2020-01-23 21:53:35 Re: BUG #16225: EL8 - PGDG postgresql* packages conflict with appstream postgresql packages
Previous Message Alvaro Herrera 2020-01-23 17:14:23 Re: DROP OWNED CASCADE vs Temp tables