You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "joellubi (via GitHub)" <gi...@apache.org> on 2023/12/04 16:34:37 UTC

[I] c/driver/postgresql: GetTableSchema does not properly handle catalog or db_schema parameters [arrow-adbc]

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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] c/driver/postgresql: GetTableSchema does not properly handle catalog or db_schema parameters [arrow-adbc]

Posted by "joellubi (via GitHub)" <gi...@apache.org>.
joellubi commented on issue #1339:
URL: https://github.com/apache/arrow-adbc/issues/1339#issuecomment-1839088065

   Relevant part of the C++ for reference: https://github.com/apache/arrow-adbc/blob/main/c/driver/postgresql/connection.cc#L1144


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] c/driver/postgresql: GetTableSchema does not properly handle catalog or db_schema parameters [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1339:
URL: https://github.com/apache/arrow-adbc/issues/1339#issuecomment-1864785380

   In Postgres, you can only access the database (catalog) you're connected to.
   
   > A client connection to the server can only access data in a single database, the one specified in the connection request.
   
   (https://www.postgresql.org/docs/current/ddl-schemas.html)
   
   However we should support catalogs properly.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] c/driver/postgresql: GetTableSchema does not properly handle catalog or db_schema parameters [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #1339: c/driver/postgresql: GetTableSchema does not properly handle catalog or db_schema parameters
URL: https://github.com/apache/arrow-adbc/issues/1339


-- 
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: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org