序列绑定字段与不绑定字段的区别 绑定字段 构造数据 drop sequence if exists test_id_seq;create sequence test_id_seq;drop table if exists test;create table test(id int default nextval(test_id_seq), name text);alter sequence test_id_seq owned b
序列绑定字段与不绑定字段的区别
测试
不绑定字段 构造数据
测试
总结 序列绑定字段,则删除表的时候,序列会被一并删除 序列不绑定字段,则序列与表是独立的,删除表不会将序列一并删除 补充:PG表中字段使用序列类型以及绑定序列实例 两种方法效果是一样的 直接看代码
|
2022-02-26
2022-09-22
2022-09-18
2022-09-22
2022-08-26