28 lines
1.0 KiB
SQL
28 lines
1.0 KiB
SQL
-- ===================================================================
|
|
-- UUID 类型测试脚本
|
|
-- 用于验证 generate_message_data.sql 中的 UUID 类型转换是否正确
|
|
-- ===================================================================
|
|
|
|
-- 测试 UUID 类型转换
|
|
SELECT
|
|
'3f8b4e5d-9c1a-4b2c-8d3e-f4a5b6c7d8e9'::uuid as uuid_test,
|
|
pg_typeof('3f8b4e5d-9c1a-4b2c-8d3e-f4a5b6c7d8e9'::uuid) as uuid_type,
|
|
gen_random_uuid() as random_uuid,
|
|
pg_typeof(gen_random_uuid()) as random_uuid_type;
|
|
|
|
-- 测试 JSONB 类型转换
|
|
SELECT
|
|
'{"urgent": true, "maintenance": true}'::jsonb as jsonb_test,
|
|
pg_typeof('{"urgent": true, "maintenance": true}'::jsonb) as jsonb_type;
|
|
|
|
-- 测试时间间隔
|
|
SELECT
|
|
now() - interval '2 hours' as time_test,
|
|
pg_typeof(now() - interval '2 hours') as time_type;
|
|
|
|
-- 验证枚举类型(如果已存在)
|
|
-- SELECT enumlabel FROM pg_enum WHERE enumtypid = 'ak_message_priority'::regtype;
|
|
-- SELECT enumlabel FROM pg_enum WHERE enumtypid = 'ak_message_status'::regtype;
|
|
|
|
COMMIT;
|