7. 選択リストなしSELECT
Allow SELECT with an empty target list (Tom Lane)
This was added so views that select from a table
with zero columns can be dumped correctly.
SELECT で空の選択リストを
許容するというもの。
8. 選択リストなしSELECT
PostgreSQL 9.3 まで
test=# SELECT ;
ERROR: syntax error at or near ";"
LINE 1: SELECT ;
^
test=#
ですよねー
10. 選択リストなしSELECT
Allow SELECT with an empty target list (Tom Lane)
This was added so views that select from a table
with zero columns can be dumped correctly.
なんか後の文章を読むと、
列のないテーブルから
選択されたビューのダンプを
正しく行なうために組み込んだ?
(自分の環境で再現できなかったけど)
12. 選択リストなしSELECT
【余談その2】
選択リストなしSELECT が可なら
列なしビューはどうなの?
test=# d no_col
Table "public.no_col"
Column | Type | Modifiers
--------+------+-----------
test=# CREATE VIEW no_col_v AS SELECT * FROM no_col;
ERROR: view must have at least one column
test=#
列なしのビューはダメらしい・・・
13. WITH ORDINALITY
Add WITH ORDINALITY syntax to number rows returned from
FROM-clause functions (Andrew Gierth, David Fetter)
This is particularly useful for functions like unnest().
この機能はFROM 句から
返される結果に
連番を付与するというもの
14. WITH ORDINALITY
ORDINALITY 指定なし
test=# SELECT * FROM (SELECT * FROM generate_series(1,100,20) )as
tmp (data); data
------
1
21
41
61
81
(5 rows)
ORDINALITY 指定あり
test=# SELECT * FROM (SELECT * FROM generate_series(1,100,20)
WITH ORDINALITY ) as tmp (data, id);
data | id
------+----
1 | 1
21 | 2
41 | 3
61 | 4
81 | 5
(5 rows)