Remove gratuitous uses of deprecated SELECT INTO

CREATE TABLE AS has been preferred over SELECT INTO (outside of ecpg
and PL/pgSQL) for a long time.  There were still a few uses of SELECT
INTO in tests and documentation, some old, some more recent.  This
changes them to CREATE TABLE AS.  Some occurrences in the tests remain
where they are specifically testing SELECT INTO parsing or similar.

Discussion: https://www.postgresql.org/message-id/flat/96dc0df3-e13a-a85d-d045-d6e2c85218da%40enterprisedb.com
This commit is contained in:
Peter Eisentraut
2021-01-28 14:01:41 +01:00
parent 6c5576075b
commit b034ef9b37
15 changed files with 30 additions and 20 deletions

View File

@ -17,7 +17,8 @@ INTERSECT
FROM onek ORDER BY random() LIMIT 1);
-- count roughly 1/10 of the tuples
SELECT count(*) AS random INTO RANDOM_TBL
CREATE TABLE RANDOM_TBL AS
SELECT count(*) AS random
FROM onek WHERE random() < 1.0/10;
-- select again, the count should be different