postgresql_16:7.1.171.5 Compatibility
PostgreSQL 16 > Reference > SQL Commands > SELECT INTO > Compatibility
The SQL standard uses SELECT INTO to represent selecting values into scalar variables of a host program, rather than creating a new table. This indeed is the usage found in ECPG (see (see postgresql_16:5.3)) and PL/pgSQL (see (see postgresql_16:6.6)). The PostgreSQL usage of SELECT INTO to represent table creation is historical. Some other SQL implementations also use SELECT INTO in this way (but most SQL implementations support CREATE TABLE AS instead). Apart from such compatibility considerations, it is best to use CREATE TABLE AS for this purpose in new code.