支持或记录 PostgreSQL 谓词“IS OF”和“IS NOT OF”?

Eva*_*oll 5 postgresql

回顾 PostgreSQL 的一些回归测试,我可以看到

SELECT x, x IS OF (text) AS is_text FROM q;
Run Code Online (Sandbox Code Playgroud)

这显然可以追溯到7.3

添加 IS OF / IS NOT OF 类型谓词 (Thomas)

是否支持这种形式。在我自己的代码中,我会写,

pg_typeof(x) = 'text'
Run Code Online (Sandbox Code Playgroud)

但我IS OF更喜欢。

Eva*_*oll 2

它还没有记录在案,但它肯定受到支持并且应该继续前进。它实际上在 SQL 2011 规范中为type predicate.

8.19 <type predicate>
Function
Specify a type test.

Format
<type predicate> ::=
<row value predicand> <type predicate part 2>

<type predicate part 2> ::=
IS [ NOT ] OF <left paren> <type list> <right paren>

<type list> ::=
<user-defined type specification>
[ { <comma> <user-defined type specification> }... ]
Run Code Online (Sandbox Code Playgroud)