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

postgres explain feature fails for queries with unreferenced parameters #17240

Open
ashanbrown opened this issue Mar 21, 2024 · 0 comments
Open

Comments

@ashanbrown
Copy link

The postgres explain feature appears to depend on being able to infer a type for every parameter when generating the prepared statement. I'm seeing this problem in an environment where hasura is generating queries and the first parameter of a quey sent to postgres is just some metadata that is ignored. In the postgres logs this looks like:

DETAIL:  parameters: $1 = '{"x-hasura-role":"admin"}', ...

Parameter $1 is not referenced at all in the query.

I suspect the solution is to explicitly provide some known type for any unreferenced parameters in the "PREPARE" statement. Alternatively, the query parameters could be renumbered, filling unreferenced parameter position, but this could have the effect of making the original query less recognizable.

Describe the results you received:

Postgres logs show this when generating the prepared statement:

ERROR:  could not determine data type of parameter $1

Describe the results you expected:
I'd like to be able to see explain results for these queries.

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

1 participant