暂无图片
暂无图片
10
暂无图片
暂无图片
暂无图片

迎国庆:PostgreSQL 15 RC1发布

原创 多米爸比 2022-09-30
1318

国庆之际,PostgreSQL全球开发组发布了15 RC1,文章链接如下:

https://www.postgresql.org/about/news/postgresql-15-rc-1-released-2516/

PostgreSQL 15 RC1相比beta4版本的主要变化是做了如下bug修复:

  • The syntax for publishing all tables in a schema using logical replication is changed to CREATE PUBLICATION … FOR TABLES IN SCHEMA …
  • Logical replication publications can now publish tables that are within a schema if both schema and table are specified.
  • Disallow publishing a schema if a table with column-lists is specified.
  • Fix issue with pg_publication_tables view where it would display dropped columns.
  • Disallow creating a new database with an unsupported ICU locale.
  • Fix behavior issue with the --gzip option for pg_basebackup where the contents of the WAL directory were not compressed.
  • Fix issue with recovery prefetching when maintenance_io_concurrency was set to a low value (e.g. 0).
  • Log errors when replaying WAL files when wal_compression is specified as either lz4 or zstd but the server does not support it.
  • Move several files generated by pg_upgrade to an internal subdirectory.
  • Clear the display from the ps command when the recovery process finishes.

可以看出最主要的修复是逻辑复制相关的bug,这也难怪,15对逻辑复制增加了很多新特性。

官方release说明比较简要,下面进一步进行分析:

1.逻辑复制针对schema发布所有表简化语法

15 RC1之前的语法是:

CREATE PUBLICATION ... FOR ALL TABLES IN SCHEMA ....

15 RC1简化为:

CREATE PUBLICATION ... FOR TABLES IN SCHEMA ....

去掉了ALL关键字,既然已经TABLES了,ALL有点多余了。

2.逻辑复制修改发布时相同schema下仍可添加带schema前缀的table

15 RC1之前会出现下面的报错:

logical_src=# alter publication pub_comp add table s3.s3_tab3;
ERROR:  cannot add relation "s3.s3_tab3" to publication
DETAIL:  Table's schema "s3" is already part of the publication or part of the specified schema list.

15 RC1修复了这个问题。

3.逻辑复制混合发布table和schema时限制table不能为部分列

15 RC1混合发布表和schema下的所有表时,限制表不能为部分列,具体可以参考下面的示例:

logical_src=# create publication pub_comp2 for table tab2(id,info2), tables in schema s3; 
ERROR:  cannot use publication column list for relation "public.tab2"
DETAIL:  Column list cannot be specified if any schema is part of the publication or specified in the list.

混合发布时,对单表必须全部发布,不能是部分列。

4.逻辑复制发布表视图pg_publication_tables修复显示删除的列

参考下面的示例:

create table t1(i serial primary key);
alter table t1 drop i;
alter table t1 add id serial primary key;
create publication pub_t1 for table t1;
select * from pg_publication_tables where pubname = 'pub_t1' \gx

attnames列显示的信息不正常

-[ RECORD 1 ]---------------------------------
pubname    | pub_t1
schemaname | public
tablename  | t1
attnames   | {........pg.dropped.1........,id}
rowfilter  | 

15 RC1显示正常如下:

-[ RECORD 1 ]------
pubname    | pub_t1
schemaname | public
tablename  | t1
attnames   | {id}
rowfilter  | 

5.修复创建数据库时如果encoding与ICU locale不匹配时及早提示

15 RC1之前创建数据库时如果encoding与ICU locale不匹配,可以创建成功

createdb --encoding SQL_ASCII --locale-provider icu --icu-locale en-US --template template0 mydb 

使用时才会报错:

psql -c "SELECT 'a' < 'b'" mydb

ERROR:  encoding "SQL_ASCII" not supported by ICU

15 RC1在创建时会直接提示错误:

createdb --encoding SQL_ASCII --locale-provider icu --icu-locale en-US --template template0 mydb 

createdb: error: database creation failed: ERROR:  encoding "SQL_ASCII" is not supported with ICU provider

6.pg_basebackup基础备份gzip选项值bug修复

详细示例请参考:

https://www.postgresql.org/message-id/1400032.1662217889@sss.pgh.pa.us

7.修复recovery_prefetch=on和maintenance_io_concurency=0时失败的场景

详细示例请参考:

https://www.postgresql.org/message-id/flat/20220831140128.GS31833%40telsasoft.com

8.当server未使用"–with-lz4","–with-zstd"编译选项而实际设置wal_compression=lz4/zstd时修复报错提示

详细示例请参考:

https://www.postgresql.org/message-id/flat/20220902115511.GY31833%40telsasoft.com#ebfa4e87b4247318ccd1e233c7c9af4a

9.pg_upgrade升级过程中部分文件转移到内部子目录中

详细示例请参考:

https://www.postgresql.org/message-id/181A6DA8-3B7F-4B71-82D5-363FF0146820@yesql.se

10.数据库启动recovery过程清理"recovering NNNNN"日志

详细示例请参考:

https://www.postgresql.org/message-id/flat/20220912005443.GB31833%40telsasoft.com#b900d448bc57e46da3a235219034ba4c

不出意外,PostgreSQL 15将于2022年10月13日正式发布。

相关文章:PostgreSQL beta1-beta4的变化

保持联系

从2019年12月开始写第一篇文章,分享的初心一直在坚持,本人现在组建了一个PG乐知乐享交流群,欢迎关注我文章的小伙伴加我微信进群吹牛唠嗑,交流技术。

456.png

最后修改时间:2022-11-08 09:51:55
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
1人已赞赏
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论