Sometimes re-running the generator overcomes it and everything is generated correctly.
After some digging, I found that the issue is with pgbouncer.
Pgbouncer sends the prepared statement to one session and the select to another, so there is the mismatch.
This also means using jackc/pgx instead of lib/pq as the driver, as the latter doesn't even offer this. This driver is usually recommended, since it is more up-to-date anyways.
This could be quite an easy fix (which I verified to be working locally), but this option works only in pgx version 4, the current one is 5. That's where I got lost. Do you have any thoughts around this?
I resolved this for our case by not connecting to pgbouncer and connecting directly instead.
Environment (please complete the following information):
OS: macosx, linux (doesn't matter)
Database: postgres
Database driver: pq/pgx - depends on this
Jet version - latest master (2.9.1)
Code snippet
The errors happen in GetTableColumnsMetaData.
Describe the bug
I set up the generator to connect to our PG database. However I'm getting these errors when running it:
Sometimes re-running the generator overcomes it and everything is generated correctly.
After some digging, I found that the issue is with pgbouncer. Pgbouncer sends the prepared statement to one session and the select to another, so there is the mismatch.
It can be fixed by supplying the
statement_cache_mode=describe
as hinted here: https://github.com/jackc/pgx/issues/650This also means using
jackc/pgx
instead oflib/pq
as the driver, as the latter doesn't even offer this. This driver is usually recommended, since it is more up-to-date anyways.This could be quite an easy fix (which I verified to be working locally), but this option works only in pgx version 4, the current one is 5. That's where I got lost. Do you have any thoughts around this?
I resolved this for our case by not connecting to pgbouncer and connecting directly instead.
Environment (please complete the following information):
Code snippet The errors happen in GetTableColumnsMetaData.