Error while using pgx and gorm V2 but the error not present in the database

Refers to Error "simple protocol queries must be run with standard_conforming_strings=on" but standard_conforming_strings is on in the database. · Issue #1368 · jackc/pgx · GitHub.

I got this Error while connecting neon.tech with headscale which use pgx and gorm as postgres library.

Maintainer of pgx replied

When a connection is made to a PostgreSQL server it reports connection settings such as standard_conforming_strings. This is how pgx knows whether it is running with standard_conforming_strings or not.

Given that this works when connecting to normal PostgreSQL directly I don’t think this is a pgx bug. I suspect this is a bug where neon.tech or headscale is not reporting or is not passing through this message.

So is neon report this setting normally? I do checked that standard_conforming_strings is on in the database I trying connect to.

Thanks for the report! I can confirm that the neon proxy doesn’t currently pass-through the standard_conforming_strings setting that Postgres sends. I’ve opened a github issue to track that: Proxy does not forward all server-reported settings to client · Issue #2752 · neondatabase/neon · GitHub.

1 Like