国庆之际,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@telsasoft.com
8.当server未使用"–with-lz4","–with-zstd"编译选项而实际设置wal_compression=lz4/zstd时修复报错提示
详细示例请参考:
https://www.postgresql.org/message-id/flat/20220902115511.gy31833@telsasoft.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@telsasoft.com#b900d448bc57e46da3a235219034ba4c
不出意外,postgresql 15将于2022年10月13日正式发布。
相关文章:postgresql beta1-beta4的变化
保持联系
从2019年12月开始写第一篇文章,分享的初心一直在坚持,本人现在组建了一个pg乐知乐享交流群,欢迎关注我文章的小伙伴加我微信进群吹牛唠嗑,交流技术。