From: | "W(dot) Matthew Wilson" <matt(at)tplus1(dot)com> |
---|---|
To: | "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org> |
Subject: | Can't register python class for domain? |
Date: | 2015-01-23 15:16:09 |
Message-ID: | CAGHfCUBwd6m9VwCTTSvzekFYevaK7+HYr42wZ52C=8S_gF6XDg@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
I created this domain:
create domain milliamp as double precision check (value >= 0);
Then when I register a python class named Milliamp, it never gets
used! I think the problem is related to the type code coming back as
the underlying double precision type:
>>> cursor.execute("select 4444::milliamp as m")
>>> cursor.description[0][1]
701
>>> cursor.execute("select 4444::double precision as f")
>>> cursor.description[0][1]
701
But there really is a type called milliamp in postgresql, I promise:
> select typname, oid from pg_type where typname in ('float8', 'milliamp');
typname oid
-------- ------
float8 701
milliamp 949531
(2 rows)
I found this code, and it suggests other people have run into this same problem:
https://github.com/beyang/psycopg2/blob/master/sandbox/domainoid.py
Any ideas what is going on?
Thanks in advance. I love psycopg!
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2015-01-23 15:21:57 | Re: Can't register python class for domain? |
Previous Message | Christophe Pettus | 2014-10-13 22:56:16 | Re: Extending copy_expert |