CREATE OR REPLACE FUNCTION boolean_to_smallint(b boolean) RETURNS smallint AS $$ BEGIN RETURN (b::boolean)::bool::int; END; $$LANGUAGE plpgsql; CREATE CAST (boolean AS smallint) WITH FUNCTION boolean_to_smallint(boolean) AS implicit;
UPDATE public."user" SET is_leader=True WHERE;
PostgreSQL数据类型有3种转换:
本文地址:https://www.0558.la/article/f5cc05b1442cf9ad2dd4.html