PgPedia 周报,2024-01-21

Commitfest 46 正在进行中;主要用户可见的功能感兴趣

一如既往,有趣的提交列表如下。

PostgreSQL 17 变更

支持分区表上的标识列

通过提交 69958631,在 PostgreSQL 17 中,分区将继承其父标识列

postgres=# CREATE TABLE identity_test (
             partkey  DATE NOT NULL,
             textval  TEXT NOT NULL,
             identkey INT GENERATED ALWAYS AS IDENTITY
           ) PARTITION BY RANGE (partkey);
CREATE TABLE

postgres=# CREATE TABLE identity_test_p1
             PARTITION OF identity_test
             FOR VALUES FROM ('2024-01-01') TO ('2024-01-31');
CREATE TABLE

postgres=# \d identity_test_p1
                     Table "public.identity_test_p1"
  Column  |  Type   | Collation | Nullable |           Default
----------+---------+-----------+----------+------------------------------
 partkey  | date    |           | not null |
 textval  | text    |           | not null |
 identkey | integer |           | not null | generated always as identity
Partition of: identity_test FOR VALUES FROM ('2024-01-01') TO ('2024-01-31')

可以直接插入

postgres=# INSERT INTO identity_test_p1 (partkey, textval)
                VALUES (current_date, 'insert via partition');
INSERT 0 1

postgres=# SELECT * FROM identity_test;
  partkey   |       textval        | identkey 
------------+----------------------+----------
 2024-01-17 | insert via partition |        1
(1 row)

PostgreSQL 16 中,分区将这样创建

postgres=# \d identity_test_p1
           Table "public.identity_test_p1"
  Column  |  Type   | Collation | Nullable | Default 
----------+---------+-----------+----------+---------
 partkey  | date    |           | not null | 
 textval  | text    |           | not null | 
 identkey | integer |           | not null | 
Partition of: identity_test FOR VALUES FROM ('2024-01-01') TO ('2024-01-31')

直接插入分区将失败

postgres=# INSERT INTO identity_test_p1 (partkey, textval)
     VALUES (current_date, 'insert via partition');
ERROR:  null value in column "identkey" of relation "identity_test_p1" violates not-null constraint
DETAIL:  Failing row contains (2024-01-17, insert via partition, null).

PostgreSQL 提交的值得关注的变更

  • 0452b461 (2024-01-21): 在优化期间探索 GROUP BY 路径键的替代排序。
  • 7ab80ac1 (2024-01-21): 泛化分组处理之前添加排序的通用代码
  • 58447e31 (2024-01-20): 添加关于不限定 UPDATE...SET 目标与关系名称的提示。
  • 075df6b2 (2024-01-20): 为范围运算符 <@ 和 @> 添加规划器支持函数。
  • abb0b4fc (2024-01-19): 教 autoprewarm 使用动态共享内存注册表。
  • 8b2bcf3f (2024-01-19): 引入动态共享内存注册表。
  • c64086b7 (2024-01-19): 重新排序 ProcArrayApplyRecoveryInfo() 中的操作
  • 6db4598f (2024-01-19): 添加 stratnum GiST 支持函数
  • b725b7ee (2024-01-19): COPY 选项从 SAVE_ERROR_TO 重命名为 ON_ERROR
  • dd0a0cfc (2024-01-19): 修复大端机器上拼写错误的字节交换函数
  • 0aba2554 (2024-01-16): 添加优化的 C 字符串哈希
  • e97b672c (2023-11-27): 为内存中使用添加内联增量哈希函数
  • 04c0897d (2024-01-19): psql: 在 bind 的非活动分支中添加 ignore_slash_options
  • 4b310636 (2024-01-19): 修复 DiscreteKnapsack() 中损坏的 Bitmapset 优化 不回溯
  • 57b440ec (2024-01-18): 修复 plpgsql 以允许新的 SQL CREATE FUNCTION 作为 SQL 命令。 回溯 ~ 14
  • e313a611 (2024-01-18): 删除 LVPagePruneState。
  • cb970240 (2024-01-18): 将 VM 更新代码从 lazy_scan_heap() 移动到 lazy_scan_prune()。
  • c120550e (2024-01-18): 优化没有索引的关系的 vacuum。
  • 686db12d (2024-01-18): 修复 PostgreSQL::Test::Cluster:psql() 中的一个问题
  • 0ae3b466 (2024-01-18): 改进 REINDEX INDEX 的已删除分区索引的处理
  • 8013850c (2024-01-18): 添加 try_index_open(),index_open() 的条件变体
  • 7cfa154d (2024-01-17): 在设置非阻塞时发生错误时关闭套接字 回溯 ~ 12
  • 2197d062 (2024-01-17): 支持解析大型 XML 数据(>= 10MB)
  • 65c5864d (2024-01-17): xml2: 用推荐的例程替换已弃用的例程
  • 9e2d8701 (2024-01-16): 添加新的 COPY 选项 SAVE_ERROR_TO
  • c7e5e994 (2024-01-17): 修复 REALLOCATE_BITMAPSETS 代码
  • 45d395cd (2024-01-16): 更一致地处理 vacuuming 时是否更新 FSM。
  • 69958631 (2024-01-16): 支持分区表中的标识列
  • 4794c2d3 (2024-01-16): libpq: 添加 PQsendPipelineSync()
  • fe093994 (2024-01-15): 修复“负位图集成员”错误
  • aa817c74 (2024-01-15): 避免无用的 ReplicationOriginExitCleanup 锁定
  • 31acee4b (2024-01-15): 减少主回归测试套件中对 money 数据类型的依赖

请注意,提交按其在提交日志中的出现顺序显示,这可能不反映单个提交的创建日期。

请参阅 PostgreSQL GIT 提交日志 查看完整的提交列表。

新 PgPedia 条目

已添加以下新条目

更新

以下文章已更新,增加了额外信息或更正

已添加了指向外部文章的链接

最后...

如果有什么遗漏,或者您有任何(建设性的)想法,请留下 反馈 和/或 购买咖啡