國慶之際,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樂知樂享交流群,歡迎關注我文章的小伙伴加我微信進群吹牛嘮嗑,交流技術。





