From: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Query execution in Perl TAP tests needs work |
Date: | 2023-08-31 01:29:37 |
Message-ID: | CA+hUKGKz715tkYFmS12fxqxWG1o9=8y3TTo2uYdGLO=EPm=BUw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Aug 31, 2023 at 10:32 AM Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> #!/usr/bin/perl
>
> use strict; use warnings;
>
> use FFI::Platypus;
>
> my $ffi = FFI::Platypus->new(api=>1);
> $ffi->lib("inst/lib/libpq.so");
>
>
> $ffi->type('opaque' => 'PGconn');
> $ffi->attach(PQconnectdb => [ 'string' ] => 'PGconn');
> $ffi->attach(PQfinish => [ 'PGconn' ] => 'void');
>
> $ffi->type('opaque' => 'PGresult');
> $ffi->attach(PQexec => [ 'PGconn', 'string' ] => 'PGresult');
> $ffi->attach(PQgetvalue => [ 'PGresult', 'int', 'int' ] => 'string');
>
> my $pgconn = PQconnectdb("dbname=postgres host=/tmp");
> my $res = PQexec($pgconn, "select count(*) from pg_class");
> my $count = PQgetvalue( $res, 0, 0);
>
> print "count: $count\n";
>
> PQfinish($pgconn);
It looks very promising so far. How hard would it be for us to add
this dependency? Mostly pinging build farm owners?
I'm still on the fence, but the more I know about IPC::Run, the better
the various let's-connect-directly-from-Perl options sound...
From | Date | Subject | |
---|---|---|---|
Next Message | David Christensen | 2023-08-31 01:50:53 | Re: Initdb-time block size specification |
Previous Message | Melanie Plageman | 2023-08-31 00:59:07 | Re: Eliminate redundant tuple visibility check in vacuum |