jupyter-xeus / xeus-sql

Jupyter kernel for SQL databases
https://xeus-sql.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
165 stars 22 forks source link

Handle postgres datatype xid? query returns Error: unknown data type with typelem: 28 #64

Closed jameshowison closed 1 year ago

jameshowison commented 2 years ago

While creating a sample query I tried to list databases using a SELECT query, running into:

Error: unknown data type with typelem: 28 for colNum: 10 with name: datfrozenxid while executing "SELECT *
FROM pg_database;".

running

SELECT *
FROM pg_database

In terminal that table has this description; it seems the xid column type is the issue?

# \d pg_database
               Table "pg_catalog.pg_database"
    Column     |   Type    | Collation | Nullable | Default 
---------------+-----------+-----------+----------+---------
 datname       | name      |           | not null | 
 datdba        | oid       |           | not null | 
 encoding      | integer   |           | not null | 
 datcollate    | name      |           | not null | 
 datctype      | name      |           | not null | 
 datistemplate | boolean   |           | not null | 
 datallowconn  | boolean   |           | not null | 
 datconnlimit  | integer   |           | not null | 
 datlastsysoid | oid       |           | not null | 
 datfrozenxid  | xid       |           | not null | 
 datminmxid    | xid       |           | not null | 
 dattablespace | oid       |           | not null | 
 datacl        | aclitem[] |           |          | 
Indexes:
    "pg_database_datname_index" UNIQUE, btree (datname), tablespace "pg_global"
    "pg_database_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
Tablespace: "pg_global"
marimeireles commented 2 years ago

Hey @jameshowison thank for opening the issue! Indeed we don't support xid. The reason for that is because the upstream library that we use to run xeus-sql doesn't support it. You can open an issue upstream and ask for them to include it. Or someone that's interested could include it themselves. Supposing the implementation of xid is similar to the oid It doesn't seem super complicated... But I really have no knowledge about SQL internals and it could actually be a beast? I'd recommend opening an issue upstream to learn more about it, and if you can link it here, would be great! :)

marimeireles commented 2 years ago

Ah, btw the upstream lib is: https://github.com/SOCI/soci

marimeireles commented 1 year ago

Closing this one as upstream.