pgsql-io / multicorn2

http://multicorn2.org
Other
73 stars 16 forks source link

Upgrade multicorn to support PostgreSQL 16 #51

Closed mfenniak closed 1 month ago

mfenniak commented 1 month ago

Major changes:

In PG16, a change was made to "Prevent extension libraries from exporting their symbols by default (Andres Freund, Tom Lane); Functions that need to be called from the core backend or other extensions must now be explicitly marked PGDLLEXPORT." As a result, some of the functions used by log_to_postgres are not available resulting in silent import errors.

The get_path_keys capability in Multicorn was affected by upstream changes (https://github.com/postgres/postgres/commit/2489d76c4906f4461a364ca8ad7e0751ead8aa0d), causing the (left_join_clauses, right_join_clauses) fields to change type from RestrictInfo to OuterJoinClauseInfo, which were easy to inspect and data.

Test changes:

Small test variations were introduced which appear non-functional:

--- multicorn_planner_test_1.out        2024-05-14 08:35:11.694628636 -0600
+++ multicorn_planner_test_2.out        2024-05-16 07:37:54.847169872 -0600
@@ -70,18 +70,20 @@
                                         QUERY PLAN
 -------------------------------------------------------------------------------------------
- Nested Loop  (cost=20.00..400100000.00 rows=500000000000 width=128)
+ Nested Loop  (cost=20.00..400125000.00 rows=500000000000 width=128)
+   Join Filter: ((m1.test1)::text = (m2.test1)::text)
    ->  Foreign Scan on testmulticorn m1  (cost=10.00..200000000.00 rows=10000000 width=20)
    ->  Foreign Scan on testmulticorn m2  (cost=10.00..20.00 rows=1 width=20)
          Filter: ((m1.test1)::text = (test1)::text)
-(4 rows)
+(5 rows)

 explain select * from testmulticorn m1 left outer join testmulticorn m2 on m1.test1 = m2.test1;
                                         QUERY PLAN
 -------------------------------------------------------------------------------------------
- Nested Loop Left Join  (cost=20.00..400100000.00 rows=500000000000 width=128)
+ Nested Loop Left Join  (cost=20.00..400125000.00 rows=500000000000 width=128)
+   Join Filter: ((m1.test1)::text = (m2.test1)::text)
    ->  Foreign Scan on testmulticorn m1  (cost=10.00..200000000.00 rows=10000000 width=20)
    ->  Foreign Scan on testmulticorn m2  (cost=10.00..20.00 rows=1 width=20)
          Filter: ((m1.test1)::text = (test1)::text)
-(4 rows)
+(5 rows)

 DROP USER MAPPING FOR current_user SERVER multicorn_srv;
--- write_test_1.out    2024-05-14 08:35:11.694628636 -0600
+++ write_test_2.out    2024-05-14 19:11:47.801691843 -0600
@@ -16,7 +16,7 @@
 NOTICE:  [('test1', 'character varying'), ('test2', 'character varying')]
 NOTICE:  BEGIN
+NOTICE:  ROLLBACK
 ERROR:  Error in python: NotImplementedError
 DETAIL:  This FDW does not support the writable API
-NOTICE:  ROLLBACK
 update testmulticorn set test1 = 'test';
 NOTICE:  BEGIN