SELECT INTO without columns or star - Mailing list pgsql-hackers

From Zhang Mingli
Subject SELECT INTO without columns or star
Date
Msg-id 06046abe-0179-44e0-8770-b1243765c079@Spark
Whole thread Raw
Responses Re: SELECT INTO without columns or star
List pgsql-hackers
Hi, hackers

When I exec a sql SELECT INTO without columns or * by mistake, it succeeds:

select * from t1;
 a | b
---+---
 1 | 2
 2 | 3
 3 | 4
(3 rows)

select into t2 from t1;
SELECT 3

 \pset null '(null)'
Null display is "(null)".

select * from t2;
--
(3 rows)

It seems that t2 has empty rows but not null. Is it an expected behavior?
And what’s the semantic of SELECT INTO without any columns?
I also see lots of that SELECT INTO in out test cases like:
-- SELECT INTO doesn't support USING
SELECT INTO tableam_tblselectinto_heap2 USING heap2 FROM tableam_tbl_heap2;

Regards,
Zhang Mingli

pgsql-hackers by date:

Previous
From: Nikita Malakhov
Date:
Subject: Re: SQL JSON path enhanced numeric literals
Next
From: "David G. Johnston"
Date:
Subject: Re: SELECT INTO without columns or star