joellubi opened a new issue, #1339:
URL: https://github.com/apache/arrow-adbc/issues/1339

   When calling `GetTableSchema` on the postgresql driver, the following 
behavior is observed:
   1. `catalog` is ignored
   2. The query produced when `db_schema` is set causes a postgres syntax error
   
   I have been able to reproduce the issues with Go and Python bindings. Below 
are the steps for reproducing in Python:
   
   ```python
   from adbc_driver_postgresql import dbapi
   
   uri = "postgresql://postgres@localhost:5432/postgres"
   
   # Setup example
   with dbapi.connect(uri) as conn:
       with conn.cursor() as cur:
           cur.execute("CREATE TABLE foo (bar int)")
       conn.commit()
   
   # Correct, inferring catalog: postgres, db_schema: public
   with dbapi.connect(uri) as conn:
       schema = conn.adbc_get_table_schema("foo")
   print(schema) # bar: int32
   
   #  Incorrect, catalog_filter is ignored
   with dbapi.connect(uri) as conn:
       schema = conn.adbc_get_table_schema("foo", catalog_filter="doesnt_exist")
   print(schema) # bar: int32
   
   #  Incorrect, raises exception when foo should be found in public schema
   with dbapi.connect(uri) as conn:
       schema = conn.adbc_get_table_schema("foo", db_schema_filter="public")
   
   # Exception raised
   OperationalError: ADBC_STATUS_IO (10): [libpq] Failed to prepare query: 
ERROR:  syntax error at or near "$2"
   LINE 1: ...= typ.oid WHERE attr.attnum >= 0 AND cls.oid = $1.$2::regcla...
                                                                ^
   
   Query was:SELECT attname, atttypid FROM pg_cat
   ```
   
   **Version Info**
   Python: 3.11.4
   adbc_driver_postgresql: 0.8.0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to