postgresql 12 分区表(partition table) 中的sequence支持

目的

调查分区表是否支持sequence。即在分区表中,如果引用了sequence的话,是否能够保证每次insert新的record后,sequence自增。

结论

支持

测试环境

centos 7 2004, postgresql 12.4

实验过程

创建sequence

test=# create sequence myseq minvalue 0;
CREATE SEQUENCE

创建分区表

test=# create table parttab (w_id integer, seq_field integer default nextval('myseq'), info text) partition by hash (w_id);
CREATE TABLE
test=# \d parttab
                   Partitioned table "public.parttab"
  Column   |  Type   | Collation | Nullable |          Default
-----------+---------+-----------+----------+----------------------------
 w_id      | integer |           |          |
 seq_field | integer |           |          | nextval('myseq'::regclass)
 info      | text    |           |          |
Partition key: HASH (w_id)
Number of partitions: 0
<
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值