On Sat, Oct 05, 2019 at 07:47:50PM +0200, Christoph Zwerschke wrote: > > Am 05.10.2019 um 18:47 schrieb Justin Pryzby: > > On Sat, Oct 05, 2019 at 06:37:36PM +0200, Christoph Zwerschke wrote: > >> Are you sure you compiled that with the pgconfig.h of Postgres 12? > >> setup.py is using the includes specified by the pgconfig tool. > > The intended behavior is to hit the runtime version check and then > > return None. > > To check, I compiled against pg12 and then downgraded libpq to v10. > > Built like: PATH=/usr/lib/postgresql/12/bin:$PATH ./setup.py build > > If I hadn't, then it wouldn't have referenced PQresultMemorySize at > > all, right ? > > Ah, yes, you're right. The runtime checks are useless because you can't even > load a shared library that doesn't support all the symbols that you are > referencing somewhere.
In general, that's false, due to lazy binding (man ld.so: /LD_BIND_NOW/) ...but maybe true for python's c modules ?? $ sudo dpkg -i /var/cache/apt/archives/libpq{5,-dev}_12*deb $ make CFLAGS="-Wall -Wextra -O3 -g -I /usr/include/postgresql" LDLIBS=-lpq t $ PGDATABASE=postgres ./t 1 3459288 $ PGDATABASE=postgres ./t 1 ./t: symbol lookup error: ./t: undefined symbol: PQresultMemorySize $ PGDATABASE=postgres ./t 0 && echo OK OK $ LD_BIND_NOW=t PGDATABASE=postgres ./t 0 ./t: symbol lookup error: ./t: undefined symbol: PQresultMemorySize Justin
// make CFLAGS="-Wall -Wextra -O3 -g -I /usr/include/postgresql" LDLIBS=-lpq t #include <libpq-fe.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { PGconn *conn = PQconnectdb(""); // PGDATABASE dbname=postgres"); if (PQstatus(conn) != CONNECTION_OK) exit(1); PGresult *res = PQexec(conn, "SELECT generate_series(1,99999)"); if (argv[1][0] == '1') printf("%zd\n", PQresultMemorySize(res)); return 0; }
_______________________________________________ PyGreSQL mailing list PyGreSQL@Vex.Net https://mail.vex.net/mailman/listinfo/pygresql