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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres: Return tables with hyphenated schemes #45754

Merged
merged 6 commits into from Mar 4, 2022

Conversation

zuchka
Copy link
Contributor

@zuchka zuchka commented Feb 22, 2022

What this PR does / why we need it:

This issue only impacts the FROM select box when using the Postres data source plugin's query builder.

If you have a schema with a hyphen in it (i.e., test-schema), any associated tables will not get populated in the query builder. The linked issue describes the situation well, and the suggested fix 馃槃

to test, add a schema with a hyphen, add the schema to your search path, and then add a table to that schema:

CREATE SCHEMA "test-schema";
ALTER ROLE youruser SET search_path = "test-schema","public";
CREATE TABLE "test-schema".test(id bigint);

as is, the table will not appear in the query builder

Which issue(s) this PR fixes:

Fixes #19743

Special notes for your reviewer:

Copy link
Member

@zoltanbedi zoltanbedi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing these issues @zuchka. I've tried this out and it works well.

public/app/plugins/datasource/postgres/meta_query.test.ts Outdated Show resolved Hide resolved
@zuchka zuchka changed the title Postgres: return tables with hyphenated schemes Postgres: Return tables with hyphenated schemes Mar 2, 2022
@daniellee daniellee merged commit 52629fb into main Mar 4, 2022
@daniellee daniellee deleted the mja/fetch-hyphenated-schemas-postgres branch March 4, 2022 08:56
@thall
Copy link

thall commented Mar 4, 2022

Ohh that old issue! Thanks! 馃槃

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

Successfully merging this pull request may close these issues.

Tables from Postgres datasource that are created under schemas with dashes are not listed
5 participants