vibhorkum / pg_background

pg_background
GNU General Public License v3.0
136 stars 35 forks source link

Does pg_background support PostgreSQL 15.3? #46

Closed pgloader closed 1 year ago

pgloader commented 1 year ago

postgres=# CREATE EXTENSION pg_background; ERROR: could not load library "/use/local/postgres/postgresql.15.3/15.3/lib/postgresql/pg_background.so": /usr/local/postgres/postgresql.15.3/15.3/lib/postgresql/pg_background.so: undefined symbol: pg_analyze_and_rewrite

pgloader commented 1 year ago

pg_background.c: In function ‘pg_background_worker_main’: pg_background.c:884:2: warning: implicit declaration of function ‘ProcessCompletedNotifies’; did you mean ‘PreCommit_Notify’? [-Wimplicit-function-declaration] ProcessCompletedNotifies(); ^~~~~~~~ PreCommit_Notify pg_background.c: In function ‘execute_sql_string’: pg_background.c:1022:42: warning: implicit declaration of function ‘pg_analyze_and_rewrite’; did you mean ‘pg_analyze_and_rewrite_withcb’? [-Wimplicit-function-declaration] querytree_list = pg_analyze_and_rewrite(parsetree, sql, NULL, 0,NULL); ^~~~~~ pg_analyze_and_rewrite_withcb pg_background.c:1022:40: warning: assignment to ‘List ’ {aka ‘struct List ’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion] querytree_list = pg_analyze_and_rewrite(parsetree, sql, NULL, 0,NULL);

vibhorkumar123 commented 1 year ago

It works for me!

root@ip-20-0-10-44 pg_background]# export PATH=/usr/pgsql-15/bin:$PATH
[root@ip-20-0-10-44 pg_background]# make install
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pg_background.o pg_background.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -shared -o pg_background.so pg_background.o -L/usr/pgsql-15/lib  -Wl,--as-needed -L/usr/lib64 -L/usr/lib  -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-15/lib',--enable-new-dtags  
/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -Xclang -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-deprecated-non-prototype -O2  -I. -I./ -I/usr/pgsql-15/include/server -I/usr/pgsql-15/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o pg_background.bc pg_background.c
/usr/bin/mkdir -p '/usr/pgsql-15/lib'
/usr/bin/mkdir -p '/usr/pgsql-15/share/extension'
/usr/bin/mkdir -p '/usr/pgsql-15/share/extension'
/usr/bin/install -c -m 755  pg_background.so '/usr/pgsql-15/lib/pg_background.so'
/usr/bin/install -c -m 644 .//pg_background.control '/usr/pgsql-15/share/extension/'
/usr/bin/install -c -m 644 .//pg_background--1.0.sql  '/usr/pgsql-15/share/extension/'
/usr/bin/mkdir -p '/usr/pgsql-15/lib/bitcode/pg_background'
/usr/bin/mkdir -p '/usr/pgsql-15/lib/bitcode'/pg_background/
/usr/bin/install -c -m 644 pg_background.bc '/usr/pgsql-15/lib/bitcode'/pg_background/./
cd '/usr/pgsql-15/lib/bitcode' && /usr/bin/llvm-lto -thinlto -thinlto-action=thinlink -o pg_background.index.bc pg_background/pg_background.bc

postgres@ip-20-0-10-44 data]$ psql -h /tmp/ postgres
psql (15.3 (EDB Postgres Extended Server 15.3.0))
Type "help" for help.

postgres=# select version();
                                                 version                                                 
---------------------------------------------------------------------------------------------------------
 PostgreSQL 15.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18), 64-bit
(1 row)

postgres=# drop extension pg_background ;
DROP EXTENSION
postgres=# CREATE EXTENSION pg_background ;
CREATE EXTENSION
postgres=# 
postgres=# \dx
                       List of installed extensions
     Name      | Version |   Schema   |            Description            
---------------+---------+------------+-----------------------------------
 pg_background | 1.0     | public     | Run SQL queries in the background
 plpgsql       | 1.0     | pg_catalog | PL/pgSQL procedural language
(2 rows)

@pgloader Could you please let me know if you are compiling the code from the main/master branch or using the pg_background release?

pgloader commented 1 year ago

@pgloader Could you please let me know if you are compiling the code from the main/master branch or using the pg_background release?

it's release 1.0. 1.1 is fine. Thanks