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

Problems, apparently with search_path #97

Open
tarkhil opened this issue Jan 28, 2025 · 3 comments
Open

Problems, apparently with search_path #97

tarkhil opened this issue Jan 28, 2025 · 3 comments
Assignees

Comments

@tarkhil
Copy link

tarkhil commented Jan 28, 2025

With a POWA 5, I'm getting an error

ERROR: UndefinedTable('relation "pages_company" does not exist\nLINE 2: FROM pages_company \n             ^\n')

The relation surely exists, it's just not in public schema.

Adding schemas to search_path for powa wouldn't work, for we have tables with same name in different schemas. No, refactoring is not an option.

@rjuju rjuju self-assigned this Jan 28, 2025
@rjuju
Copy link
Member

rjuju commented Jan 28, 2025

Hi,

I don't know in which widget you get this error, I'm assuming for the index suggestion, but it's likely that we won't be able to do anything. pg_stat_statements doesn't store the search_path associated with the query when the query string is recorded, so for an external consumer like powa all you get is the query string. We try to provide as much insight as possible but in that case the schema information is just not available anywhere.

@tarkhil
Copy link
Author

tarkhil commented Jan 28, 2025

So there's no way to store OID by pg_stat_statements and I'm advised to suggest a patch?...

@rjuju
Copy link
Member

rjuju commented Jan 28, 2025

The problem is actually way more complex that just storing one oid. Your query could be referencing multiple relation in multiple schema, but each functions and operators could also be in multiple schema. So the only real solution would be for pg_stat_statements to store a query where each object has been fully qualified to avoid such problem, This has been discussed upstream some time ago, and rejected IIRC because it would be very expensive, hard to maintain and the stored query would not look like the query the user issued in the first place. You're of course free to start the discussion again with your own experience and problem reports, maybe the outcome would be different (although I wouldn't have much hopes).

On the powa side the only thing we could do is to have a way for you to specify a search_path on the page where this problem happens.

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