デフォルトのプロンプトで (%x) 表示
●PostgreSQL 12 まで
testdb=# BEGIN;
BEGIN
testdb=# INSERT INTO test VALUES (1, 'abc');
INSERT 0 1
testdb=# ERROR;
ERROR: syntax error at or near "ERROR"
LINE 1: ERROR;
^
testdb=# ROLLBACK;
ROLLBACK
testdb=#
testdb=# BEGIN;
BEGIN
testdb=*# INSERT INTO test VALUES (1, 'abc');
INSERT 0 1
testdb=*# ERROR;
ERROR: syntax error at or near "ERROR"
LINE 1: ERROR;
^
testdb=!# ROLLBACK;
ROLLBACK
testdb=#
● PostgreSQL 13
7.
デフォルトのプロンプトで (%x) 表示
●PostgreSQL 12 まで
testdb=# BEGIN;
BEGIN
testdb=# INSERT INTO test VALUES (1, 'abc');
INSERT 0 1
testdb=# ERROR;
ERROR: syntax error at or near "ERROR"
LINE 1: ERROR;
^
testdb=# ROLLBACK;
ROLLBACK
testdb=#
おわかりいただけたであろうか・・・
testdb=# BEGIN;
BEGIN
testdb=*# INSERT INTO test VALUES (1, 'abc');
INSERT 0 1
testdb=*# ERROR;
ERROR: syntax error at or near "ERROR"
LINE 1: ERROR;
^
testdb=!# ROLLBACK;
ROLLBACK
testdb=#
● PostgreSQL 13
8.
デフォルトのプロンプトで (%x) 表示
testdb=#BEGIN;
BEGIN
testdb=# INSERT INTO test VALUES (1, 'abc');
INSERT 0 1
testdb=# ERROR;
ERROR: syntax error at or near "ERROR"
LINE 1: ERROR;
^
testdb=# ROLLBACK;
ROLLBACK
testdb=#
testdb=# BEGIN;
BEGIN
testdb=*# INSERT INTO test VALUES (1, 'abc');
INSERT 0 1
testdb=*# ERROR;
ERROR: syntax error at or near "ERROR"
LINE 1: ERROR;
^
testdb=!# ROLLBACK;
ROLLBACK
testdb=#
● PostgreSQL 12 まで ● PostgreSQL 13
# の左になんかついている!
9.
デフォルトのプロンプトで (%x) 表示
●プロンプトでトランザクション状態がわかるようになった。
トランザクションの状態 state プロンプト
トランザクション外
(セッション開始直後)
idle
#
トランザクション内 Idel in transaction
*#
トランザクション内で
異常発生時
Idle in transaction (abort)
!#
演算子クラス / 演算子族の表示
●PostgreSQL 12 まで
testdb=# ?
(中略)
Informational
(options: S = show system objects, + = additional detail)
d[S+] list tables, views, and sequences
d[S+] NAME describe table, view, sequence, or index
da[S] [PATTERN] list aggregates
dA[+] [PATTERN] list access methods
db[+] [PATTERN] list tablespaces
testdb-# ?
(中略)
Informational
(options: S = show system objects, + = additional detail)
d[S+] list tables, views, and sequences
d[S+] NAME describe table, view, sequence, or index
da[S] [PATTERN] list aggregates
dA[+] [PATTERN] list access methods
dAc[+] [AMPTRN [TYPEPTRN]] list operator classes
dAf[+] [AMPTRN [TYPEPTRN]] list operator families
dAo[+] [AMPTRN [OPFPTRN]] list operators of operator families
dAp [AMPTRN [OPFPTRN]] list procedures of operator families
db[+] [PATTERN] list tablespaces
● PostgreSQL 13
24.
演算子クラス / 演算子族の表示
●PostgreSQL 12 まで
testdb=# ?
(中略)
Informational
(options: S = show system objects, + = additional detail)
d[S+] list tables, views, and sequences
d[S+] NAME describe table, view, sequence, or index
da[S] [PATTERN] list aggregates
dA[+] [PATTERN] list access methods
db[+] [PATTERN] list tablespaces
おわかりいただけたであろうか・・・
testdb-# ?
(中略)
Informational
(options: S = show system objects, + = additional detail)
d[S+] list tables, views, and sequences
d[S+] NAME describe table, view, sequence, or index
da[S] [PATTERN] list aggregates
dA[+] [PATTERN] list access methods
dAc[+] [AMPTRN [TYPEPTRN]] list operator classes
dAf[+] [AMPTRN [TYPEPTRN]] list operator families
dAo[+] [AMPTRN [OPFPTRN]] list operators of operator families
dAp [AMPTRN [OPFPTRN]] list procedures of operator families
db[+] [PATTERN] list tablespaces
● PostgreSQL 13
25.
演算子クラス / 演算子族の表示
●PostgreSQL 12 まで
testdb=# ?
(中略)
Informational
(options: S = show system objects, + = additional detail)
d[S+] list tables, views, and sequences
d[S+] NAME describe table, view, sequence, or index
da[S] [PATTERN] list aggregates
dA[+] [PATTERN] list access methods
db[+] [PATTERN] list tablespaces
なんかめっさ増えてない?
testdb-# ?
(中略)
Informational
(options: S = show system objects, + = additional detail)
d[S+] list tables, views, and sequences
d[S+] NAME describe table, view, sequence, or index
da[S] [PATTERN] list aggregates
dA[+] [PATTERN] list access methods
dAc[+] [AMPTRN [TYPEPTRN]] list operator classes
dAf[+] [AMPTRN [TYPEPTRN]] list operator families
dAo[+] [AMPTRN [OPFPTRN]] list operators of operator families
dAp [AMPTRN [OPFPTRN]] list procedures of operator families
db[+] [PATTERN] list tablespaces
● PostgreSQL 13
演算子クラス / 演算子族の表示
●自作データ型fractionの演算子クラス / 演算子族の表示例
testdb=# dAc btree fraction
List of operator classes
AM | Input type | Storage type | Operator class | Default?
-------+------------+--------------+----------------+----------
btree | fraction | | fraction_ops | yes
(1 row)
testdb=# dAf btree fraction
List of operator families
AM | Operator family | Applicable types
-------+-----------------+------------------
btree | fraction_ops | fraction
(1 row)
testdb=# dAo btree fraction_ops
List of operators of operator families
AM | Operator family | Operator
-------+-----------------+-------------------------
btree | fraction_ops | < (fraction, fraction)
btree | fraction_ops | <= (fraction, fraction)
btree | fraction_ops | = (fraction, fraction)
btree | fraction_ops | >= (fraction, fraction)
btree | fraction_ops | > (fraction, fraction)
(5 rows)
testdb=# dAp btree fraction_ops
List of procedures of operator families
AM | Operator family | Left arg type | Right arg type | Number | Proc name
-------+-----------------+---------------+----------------+--------+--------------
btree | fraction_ops | fraction | fraction | 1 | fraction_cmp
(1 row)
testdb=#
29.
演算子クラス / 演算子族の表示
●こんな使い方の例もある。
● pg_bigm で全文インデックス設定するときに opclass の名前を忘れちまっ
て設定できない・・・
testdb=# CREATE INDEX data_bigm_idx ON test USING gin (data);
ERROR: data type text has no default operator class for access method "gin"
HINT: You must specify an operator class for the index or define a default operator class for the data type.
testdb=#
testdb=# dAc gin text
List of operator classes
AM | Input type | Storage type | Operator class | Default?
-----+------------+--------------+----------------+----------
gin | text | | gin_bigm_ops | no
(1 row)
testdb=# CREATE INDEX data_bigm_idx ON test USING gin (data gin_bigm_ops);
CREATE INDEX
testdb=#
● そんなときには dAc を叩いて Operator class を参照しよう。
にゃーん
ファイルパスの TAB 補完改善
●PostgreSQL 12 まで
testdb=# COPY test FROM '/tmp/t testdb=# COPY test FROM '/tmp/t
● PostgreSQL 13
ここで水平タブを入力すると・・・
testdb=# COPY test FROM /tmp/test.dat testdb=# COPY test FROM '/tmp/test.dat'
57.
ファイルパスの TAB 補完改善
●PostgreSQL 12 まで
testdb=# COPY test FROM '/tmp/t testdb=# COPY test FROM '/tmp/t
● PostgreSQL 13
ここで水平タブを入力すると・・・
testdb=# COPY test FROM /tmp/test.dat testdb=# COPY test FROM '/tmp/test.dat'
おわかりいただけたであろうか・・・
58.
ファイルパスの TAB 補完改善
●PostgreSQL 12 まで
testdb=# COPY test FROM '/tmp/t testdb=# COPY test FROM '/tmp/t
● PostgreSQL 13
ここで水平タブを入力すると・・・
testdb=# COPY test FROM /tmp/test.dat testdb=# COPY test FROM '/tmp/test.dat'
消える!シングルクォート!
にゃーん
改善っていうか Bug-Fix に近いような気がする。
残る!シングルクォート!