Support needed for user-defined types
Bug #412000 reported by
Dan Halbert
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pg8000 |
Fix Committed
|
Undecided
|
Mariano Reingart |
Bug Description
User-defined types (e.g. ENUM) are not supported. They generate errors like "type oid 16785 not mapped to py type".
Perhaps they could be supported as strings; psycopg2 does this. psycopg2 also also a type-extension mechanism for fancier type conversions.
To post a comment you must log in.
Test case:
from pg8000 import dbapi
connection = dbapi.connect( user='scott' , password='tiger', host='localhost', database='test')
cursor = connection.cursor()
cursor. execute( "CREATE TYPE mytype AS ENUM ('one', 'two', 'three')") execute( "CREATE TABLE mytable (somedata mytype)") execute( "INSERT INTO mytable (somedata) VALUES (%s)", ["two"])
cursor.
cursor.
produces:
pg8000. errors. ProgrammingErro r: ('ERROR', '42804', 'column "somedata" is of type mytype but expression is of type text')