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

We couldn't get plans for this query, presumably because some parameters are missing: relation "core_departurecalculationtask" does not exist #213

Open
tarkhil opened this issue Sep 11, 2024 · 1 comment
Assignees
Labels

Comments

@tarkhil
Copy link

tarkhil commented Sep 11, 2024

Hello

I'm using powa on a moderately complex database with several schemas and search_path set appropriately for all users.

However, requests are stored by powa without full specification and powa-web cannot analyze SOME queries. That's another mystery, for some are analyzed.

What could be wrong?

@rjuju rjuju self-assigned this Sep 11, 2024
@rjuju rjuju added the question label Sep 11, 2024
@rjuju
Copy link
Member

rjuju commented Sep 11, 2024

There are multiple reasons that could explain a failure in getting this kind of error.

First of all, powa gets the data (which here is the normalized query text) from pg_stat_statements, and that extensions normalize the query string as-is, without trying to fully qualify object or store the associated search_path at the time the query text is stored. This has already been discussed in the past (see for instance https://www.postgresql.org/message-id/flat/9baf5c06-d6ab-c688-010c-843348e3d98c%40gmail.com for the last one I remember), but unfortunately none of the committer is interested in that topic nothing was ever done.

Note also that pg_stat_statements stores the first query string associated to an entry, so if you sometime use the search_path and sometime rely on fully qualified objects for the exact same queryid, you may or may not get a useful entry.

Since the error is relation "core_departurecalculationtask" does not exist, I'm assuming that either that table does not exist anymore (maybe a temporary table or a table dropped since), or more likely it was stored by pg_stat_statements using a non default search_path.

Maybe it works for some other queries because the saved query text was qualified, or because there's a matching relation relation name (not necessarily the same object as the one in the query though) in the connection default search_path.

Unfortunately there isn't much we can do without change in pg_stat_statements. The only possibility on the powa side would be to let users manually tag the queries with a search_path, but it looks like a lot of error-prone work for users.

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

No branches or pull requests

2 participants