-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't seem to use prepared statements using libpq #223
Comments
I think we're having the same issue. We're using Without prepared statements this works fine, all prepared statements fail. When using the native driver (libpq) queries fail and the logs are filled with these notices:
It also fails when using the javascript driver with the following:
[2] According to [3] I've not narrowed down whether this is caused by [0] https://node-postgres.com/ |
I noticed that PGlite will return a Here is what I saw when connecting from
vs.
The extra The above were tested using this import pg from 'pg';
const { Client } = pg;
const client = new Client(
'postgresql://postgres:postgres@localhost:5432/postgres',
);
await client.connect();
const res = await client.query('SELECT $1::text as message', ['Hello world!']);
console.log(res.rows);
await client.end(); |
@gregnr you mentioned:
Any chance you could share the code you used to test this? I'd love to crib from it while this issue is being fixed. |
@joehan if you're willing to use an experimental version of pg-gateway, I've created a branch This is based off of the Web standard APIs PR which isn't merged yet, so unfortunately there's no release for this code yet (you would need to clone and build yourself). I did try back porting the patch to work with the current v0.2.4 version of pg-gateway but kept hitting other upstream bugs that I'm guessing were inherently fixed in the Web standard APIs branch. Hoping to get that PR merged and released soon. |
I'm trying to use pglite with a libpq-based application. I'm using pg-gateway as a proxy.
Following sample C code snippet (which calls
PQprepare
andPQexecPrepared
) seems not work with pglite.When I run this using a normal Postgres database I get the expected result:
When I use pglite, I get this:
Code snippet from the server, mostly borrowed from https://github.com/supabase-community/pg-gateway?tab=readme-ov-file#pglite:
Seems to happen on both Linux and Windows. When I don't use prepared statements (e.g. by using
PQexec
), it seems to work as expected.The text was updated successfully, but these errors were encountered: