2017-10-07 30 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; 
相关问题