vibhorkum / pg_background

pg_background
GNU General Public License v3.0
147 stars 36 forks source link

Pg_background-1.0 is not compatible yet with PostgreSQL 15 #43

Closed YuriKulaghin closed 1 year ago

YuriKulaghin commented 1 year ago

Hello! With PostgreSQL 15 make gives warnings/errors:

pg_background.c:884:2: warning: implicit declaration of function ‘ProcessCompletedNotifies’
pg_background.c:1022:42: warning: implicit declaration of function ‘pg_analyze_and_rewrite’

I offer following patch:

--- pg_background-1.0/pg_background.c
+++ pg_background-1.1/pg_background.c
@@ -882,5 +882,7 @@
    disable_timeout(STATEMENT_TIMEOUT, false);
    CommitTransactionCommand();
+   #if PG_VERSION_NUM < 150000
    ProcessCompletedNotifies();
+   #endif
        pgstat_report_activity(STATE_IDLE, sql);
    pgstat_report_stat(true);
@@ -1019,5 +1021,7 @@
         */
        oldcontext = MemoryContextSwitchTo(parsecontext);
-                #if PG_VERSION_NUM >= 100000
+                #if PG_VERSION_NUM >= 150000
+                        querytree_list = pg_analyze_and_rewrite_fixedparams(parsetree, sql, NULL, 0,NULL);
+       #elif PG_VERSION_NUM >= 100000
                         querytree_list = pg_analyze_and_rewrite(parsetree, sql, NULL, 0,NULL);
                 #else

It works for me, check it for PostgreSQL logic.

devrimgunduz commented 1 year ago

@vibhorkum ping.

vibhorkumar123 commented 1 year ago

@devrimgunduz Looking into it

vibhorkumar123 commented 1 year ago

Fix has been already included in master branch

vibhorkum commented 1 year ago

@devrimgunduz @YuriKulaghin Below is the latest release which has support for PostgreSQL 15 https://github.com/vibhorkum/pg_background/releases/tag/v1.1

Please let me know if you have any questions or if you see any issues with the latest version.