-
Notifications
You must be signed in to change notification settings - Fork 173
fix(c/driver/postgresql): honor GetObjects schema filter #3855
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(c/driver/postgresql): honor GetObjects schema filter #3855
Conversation
Remove pg_table_is_visible() from the tables query so schema filtering does not depend on search_path.\n\nAdd regression coverage in the C++ PostgreSQL driver tests and Python DBAPI tests.
|
Thanks! |
|
It seems other tests leave behind some stuff that causes the new test to fail. Maybe it can be a little more forgiving? |
… extra catalogs PostgreSQL exposes template catalogs (template0/template1) so GetObjects may return multiple catalog rows even when schema/table filters are used. Update the regression test to select the current catalog entry.
|
Pushed a follow-up commit to make the Python regression test tolerant of Postgres returning multiple catalogs (e.g., template0/template1). The test now selects the current catalog entry instead of assuming a single row. |
|
The linter made a change 😅 diff --git a/python/adbc_driver_postgresql/tests/test_dbapi.py b/python/adbc_driver_postgresql/tests/test_dbapi.py
index aae214275..5fe72cfa3 100644
--- a/python/adbc_driver_postgresql/tests/test_dbapi.py
+++ b/python/adbc_driver_postgresql/tests/test_dbapi.py
@@ -24,6 +24,7 @@ import numpy
import pyarrow
import pyarrow.dataset
import pytest
+
from adbc_driver_postgresql import ConnectionOptions, StatementOptions, dbapi
@@ -81,7 +82,9 @@ def test_get_objects_schema_filter_outside_search_path(
)
catalog_name = postgres.adbc_current_catalog
- catalog = next((row for row in metadata if row["catalog_name"] == catalog_name), None)
+ catalog = next(
+ (row for row in metadata if row["catalog_name"] == catalog_name), None
+ )
assert catalog is not None
schemas = catalog["catalog_db_schemas"] |
|
Re-ran the CI-style flow locally (Ubuntu container + compose |
Summary
Fix the PostgreSQL driver’s
GetObjectstable enumeration sodb_schema/db_schema_filterdoes not depend onsearch_path.Details
The tables query used
pg_catalog.pg_table_is_visible(c.oid), which issearch_path-dependent and can hide tables in non-current schemas even when a schema filter is provided. Remove that predicate and rely on the explicit schema predicate.Tests
pre-commit runctest -L driver-postgresql(againstpostgres-testfromdocker compose)Closes #3854