Skip to content
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

query_typed still uses prepared statements sometimes, to get type info #1204

Open
radix opened this issue Jan 30, 2025 · 1 comment
Open

Comments

@radix
Copy link

radix commented Jan 30, 2025

We are trying to use query_typed in an environment with pgcat -- we are using query_typed specifically because it avoids prepared statements, which we can't use with pgcat.

However, it seems that query_typed sometimes still uses prepared statements, if you trace the code where it calls get_type and then query::query. This is happening in a situation where we are trying to query a value that has a custom type (an enum that we've defined in postgres).

So, I think at the very least, this gotcha should probably be called out in query_typed's documentation, but I also wonder if it can be avoided by having get_type use query_typed instead of query? (I also see some code that is explicitly prepareing something in get_type too, I'm not sure if that's also about prepared statements - I have not spent a ton of time reading the code yet).

@sfackler
Copy link
Owner

We currently cache the prepared statements used for type retrieval. We could stop doing that and use query_typed - it'd probably the type lookups slightly slower but I'm assuming it would probably be unnoticeable in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants