pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: 逗比请来的猴子 <xh2432@vip.qq.com>
To: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: SELECT * FROM a WHERE id IN (sub query) .   When sub query is incorrect . return all rows of table a
Date: Wed, 17 Jun 2020 22:56:10 +0800
Message-ID: <tencent_C931F3C82E827FD2FC5E9E544124FF202E05@qq.com> (raw)

When I have 2 tables like this&nbsp;
create table test
(
id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int4,
shapeid&nbsp; &nbsp; &nbsp; &nbsp; int4
);


table testb
(
id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int4
);





table test has 4 records and table has 1 recors.


sql&nbsp; " select shapeid from testb; "&nbsp; &nbsp; &nbsp;Failed.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;


but&nbsp; sql&nbsp; " select * from test where shapeid in ( SELECT shapeid FROM testb ); "&nbsp; return all records of table test&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;


sql like this delete all records of my talbe !

Attachments:

2FFAC80B@56932806.0A2FEA5E.png.jpg (image/jpeg, 17.6K) download view image
0006A22B@0BD9BF6D.0A2FEA5E.png.jpg (image/jpeg, 14.8K) download view image
pg_test1.png (application/octet-stream, 17.6K) download pg_test2.png (application/octet-stream, 8.8K) download pg_test3.png (application/octet-stream, 7.4K) download pg_test4.png (application/octet-stream, 14.8K) download

view thread (2+ messages)  latest in thread

Message-ID: <tencent_C931F3C82E827FD2FC5E9E544124FF202E05@qq.com>
Permalink:  ../tencent_C931F3C82E827FD2FC5E9E544124FF202E05@qq.com/
Also on:    postgresql.org/message-id/tencent_C931F3C82E827FD2FC5E9E544124FF202E05@qq.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: xh2432@vip.qq.com
  Subject: Re: SELECT * FROM a WHERE id IN (sub query) .   When sub query is incorrect . return all rows of table a
  In-Reply-To: <tencent_C931F3C82E827FD2FC5E9E544124FF202E05@qq.com>
  References: <tencent_C931F3C82E827FD2FC5E9E544124FF202E05@qq.com>

* 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