Open hazirliver opened 1 month ago
@hazirliver Thanks for the report, looks like a bug!
How do we want to approach this? All we have at parse time is (I think) the string of the datatype name, which in this case is "dataset_source_enum"
Do we want to have a naming convention around custom types? Or should we just fallback to treating things as strings if we (and sqlglot) can't recognize it?
Naturally, this is possible with a bit of elbow grease, and it's a bit annoying:
psql -E
and then run \dT+
to see the SQL used to list custom types)tuple
(named struct types essentially), so then use that to determine what the custom type corresponds tocontext
argument that is perhaps a mapping from custom typename -> underlying type that sqlglot knows about.
What happened?
I encountered an issue when attempting to load a PostgreSQL table
dataset_source
that contains a custom ENUM data typedataset_source_enum
. The error occurs both when usingcon.table('dataset_source')
andcon.sql("SELECT * FROM dataset_source;")
. Steps to reproduce:Create a custom ENUM type in PostgreSQL:
Create a table using the ENUM type:
Insert some data into the table:
Attempt to load the table in ibis:
db_config = { 'user': '', 'password': "", 'host': '', 'port': '', 'database': '***' }
con = ibis.postgres.connect(*db_config) con.table('dataset_source') # gives same error: con.sql("SELECT FROM dataset_source;")
Code of Conduct