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

fix exclude/include tables #131

Merged
merged 3 commits into from
Oct 30, 2023
Merged

fix exclude/include tables #131

merged 3 commits into from
Oct 30, 2023

Conversation

vincentsarago
Copy link
Member

closes #130

@@ -246,10 +246,11 @@ CREATE OR REPLACE FUNCTION pg_temp.tipg_catalog(
AND relkind IN ('r','v', 'm', 'f', 'p')
AND has_table_privilege(c.oid, 'SELECT')
AND c.relname::text NOT IN ('spatial_ref_sys','geometry_columns','geography_columns')
AND (exclude_tables IS NULL OR concat(c.relnamespace::regnamespace::text,'.',c.relname::text) != ANY (exclude_tables))
AND (exclude_tables IS NULL OR concat(c.relnamespace::regnamespace::text,'.',c.relname::text) <> ALL (exclude_tables))
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems to fix #130

AND (functions IS NULL OR concat(p.pronamespace::regnamespace::text, '.', proname::text) = ANY (functions))
AND (exclude_functions IS NULL OR concat(p.pronamespace::regnamespace::text,'.',proname::text) != ANY (exclude_functions))
AND (exclude_functions IS NULL OR concat(p.pronamespace::regnamespace::text,'.',proname::text) <> ALL (exclude_functions))
AND (functions IS NULL OR concat(p.pronamespace::regnamespace::text,'.',proname::text) = ANY (functions))
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand but the include/exclude filter do not work for function (see the failing tests)
cc @bitner

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, this is because the actual namespace of the function isn't pg_temp -- pg_temp is an automatic alias for a temp schema that is created behind the scenes

@@ -140,7 +141,7 @@ def test_collections_includes(app_includes):
assert response.status_code == 200
body = response.json()
ids = [x["id"] for x in body["collections"]]
assert ["public.nongeo_data"] == ids
assert ["public.minnesota", "public.nongeo_data"] == ids
Copy link
Member Author

Choose a reason for hiding this comment

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

tests for #130

assert response.status_code == 200
body = response.json()
ids = [x["id"] for x in body["collections"]]
assert ["pg_temp.hexagons", "pg_temp.squares"] == ids
Copy link
Member Author

Choose a reason for hiding this comment

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

Those 2 tests are failing right now 🤷

@jonaraphael
Copy link

Just checking on the progress for this bug?

@vincentsarago vincentsarago merged commit 8a54e31 into main Oct 30, 2023
7 checks passed
@vincentsarago vincentsarago deleted the patch/includes-excludes branch October 30, 2023 19:23
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

Successfully merging this pull request may close these issues.

[BUG] TIPG_DB_EXCLUDE_TABLES only accepts list of length 1
3 participants