2017-10-07 23 views
0

私はバージョン9.5で、既存のチェックテーブルのためにこの作品を使用して、それが正常に動作します:バージョン9.6のto_regclass引数のデータ型とは何ですか?

do $$ 
declare v text; 
begin 
    SELECT to_regclass(('some'||'table')::cstring) into v; 
    raise notice '%', v; 
end; 
$$ language plpgsql 

は今、私はバージョン9.6を持つ別の(リモート)データベースと、このコードでは動作し、エラーを生成:

function to_regclass(cstring) does not exist

では、postgres 9.6のto_regclass()関数の引数のデータ型は何ですか?

答えて

0

Postgres 9.6では、to_regclass()の引数はtext(以前のバージョンではcstring)です。 the documentation:

Make the to_reg*() functions accept type text not cstring (Petr Korobeinikov)

This avoids the need to write an explicit cast in most cases where the argument is not a simple literal constant.

から

regclassデータにテキスト式のシンプルなキャストが両方のバージョンで動作するはずです:

SELECT ('some'||'table')::regclass into v; 
関連する問題