这些都是有效的查询:
SELECT;
-- 1 rows affected
SELECT EXCEPT SELECT;
-- 2 rows affected
SELECT 1 WHERE EXISTS (SELECT);
--1
WITH cte AS (VALUES(1),(2))
SELECT
FROM cte;
--2 rows affected
和DDL:
CREATE TABLE z AS SELECT;
SELECT *
FROM information_schema.columns
WHERE table_name = 'z';
-- empty
SELECT attrelid::regclass AS tbl
, attname AS col
, atttypid::regtype AS datatype
FROM pg_attribute
WHERE attrelid = 'z'::regclass
ORDER BY attnum;
-- internal columns
我想知道可以使用零列选择(现实场景),或者只是PostgreSQL语言扩展/语法怪癖。