简体   繁体   中英

Create cast as a non-superuser user with Postgresql

I have a specific need to create a new cast in postgresql 9.6:

CREATE OR REPLACE FUNCTION boolean_to_float(b boolean) RETURNS float AS $$
SELECT b::int::float;$$ LANGUAGE SQL;
DROP CAST IF EXISTS (boolean as float);
CREATE CAST (boolean AS float) WITH FUNCTION boolean_to_float(boolean) ;

Unfortunately, I got the following response:

ERROR:  must be owner of type boolean or type double precision

The database is owned by the user I am using. Is it possible to force the DROP/CREATE CAST ?

正如错误消息所说:你必须以用户postgres身份连接才能做到这一点。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM