最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PostgreSQL 序列綁定字段與不綁定字段的區(qū)別說明

 更新時間:2021年02月01日 15:46:51   作者:岳麓丹楓001  
這篇文章主要介紹了PostgreSQL 序列綁定字段與不綁定字段的區(qū)別說明,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

序列綁定字段與不綁定字段的區(qū)別

綁定字段

構(gòu)造數(shù)據(jù)

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 by test.id;

測試

test=# drop table test;
DROP TABLE
test=# \d
Did not find any relations.
test=# 

不綁定字段

構(gòu)造數(shù)據(jù)

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);

測試

test=# drop table test;
DROP TABLE
test=# \d
       List of relations
 Schema |  Name   |  Type  | Owner  
--------+-------------+----------+----------
 public | test_id_seq | sequence | postgres
(1 row)

test=# 

總結(jié)

序列綁定字段,則刪除表的時候,序列會被一并刪除

序列不綁定字段,則序列與表是獨(dú)立的,刪除表不會將序列一并刪除

補(bǔ)充:PG表中字段使用序列類型以及綁定序列實(shí)例

兩種方法效果是一樣的

直接看代碼

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。如有錯誤或未考慮完全的地方,望不吝賜教。

相關(guān)文章

最新評論

淳安县| 丹棱县| 延津县| 合山市| 抚州市| 宣化县| 洱源县| 云南省| 无为县| 朝阳市| 宜兰县| 扎囊县| 衢州市| 武夷山市| 衢州市| 通辽市| 陇南市| 冷水江市| 郎溪县| 广汉市| 灵石县| 洞口县| 安义县| 蛟河市| 项城市| 阳春市| 武功县| 正定县| 沐川县| 交城县| 邳州市| 灵丘县| 安图县| 钟祥市| 阿荣旗| 绵阳市| 黄浦区| 栾城县| 青田县| 射洪县| 大港区|