pgsql的UUID生成函数

– pgsql
– 安装函数
– UUID生成函数: pgsql默认安装是没有该类函数的,若脚本执行到此处出错,需打开下面注释,安装UUID生成函数
create extension “uuid-ossp” ;

– 使用函数
select uuid_generate_v4();

select replace(cast(uuid_generate_v4() as VARCHAR), ‘-’, ‘’);

select translate(cast(uuid_generate_v4() as VARCHAR), ‘-’, ‘’);

INSERT INTO mdc.base_org (
uuid,
NAME,
org_parent_uuid,
delete_flag,
court_uuid,
create_time,
update_time,
create_user,
update_user,
is_parent,
sort_by,
org_type
)
VALUES
(
(
SELECT
REPLACE (
CAST (
uuid_generate_v4 () AS VARCHAR
),
‘-’,
‘’
)
),
‘测试小区’,
‘0’,
1,
‘c69aeede4f6341929721e2892beec3cb’,
now(),
now(),
‘admin’,
‘admin’,
TRUE,
‘001’,
‘1’
);

你可能感兴趣的:(数据库,pgsql)