3

ここで何が起きてるの?

test1 と test2 の 2 つのテーブルを取得しました。

create table test1 (id1 int4 primary key);
create table test2 (id2 int4 primary key);

予想どおり、このクエリは次のとおりです。

select id1 from test2;

次の構文エラーが発生します。

ERROR:  column "id1" does not exist
LINE 1: select id1 from test2;

ただし、このクエリを実行しようとすると:

select * from test1 where id1 in (select id1 from test2);

PostgreSQL は文句を言わず、クエリを実行して次のように表示します。

 id1
-----
(0 rows)

これには何か論理がありますか?または、バグレポートを提出する必要がありますか?

4

1 に答える 1