pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: flavio.ricci82@gmail.com
Subject: BUG #16834: where-in: if the nested query fails, the parent query returns all the records
Date: Fri, 22 Jan 2021 11:56:11 +0000
Message-ID: <16834-f05c5c8510bf31a9@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16834
Logged by:          Flavio Ricci
Email address:      flavio.ricci82@gmail.com
PostgreSQL version: 11.9
Operating system:   x86_64-pc-linux-gnu
Description:        

Hi,

I have found out that in  a where-in query if the nested query fails, the
parent query returns all the records if the where condition field matches
with the selected field in the inner query.
Example:
SELECT *
FROM  table_a 
WHERE field_only_in_parent_table IN (
   SELECT field_only_in_parent_table 
   FROM table_b 
   WHERE name = 'John Doe')

If you run only the nested query it fails because the field does not exist
for table_b
If you run all the query, it returns all the records of table_a

Regards,

Flavio



view thread (5+ messages)  latest in thread

Message-ID: <16834-f05c5c8510bf31a9@postgresql.org>
Permalink:  ../16834-f05c5c8510bf31a9@postgresql.org/
Also on:    postgresql.org/message-id/16834-f05c5c8510bf31a9@postgresql.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, flavio.ricci82@gmail.com
  Subject: Re: BUG #16834: where-in: if the nested query fails, the parent query returns all the records
  In-Reply-To: <16834-f05c5c8510bf31a9@postgresql.org>

* 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