Re: empty string in composite data types
От | Daniele Varrazzo |
---|---|
Тема | Re: empty string in composite data types |
Дата | |
Msg-id | CA+mi_8ZO+VranEYGWnUgsAJ=WbtTxP0UWGw+CZcA7DPcBuNmqw@mail.gmail.com обсуждение исходный текст |
Ответ на | empty string in composite data types (Christian von Kietzell <christian@vonkietzell.de>) |
Ответы |
Re: empty string in composite data types
|
Список | psycopg |
On Mon, Dec 3, 2012 at 12:15 PM, Christian von Kietzell <christian@vonkietzell.de> wrote: > Hi, > > I noticed some (imho) odd behaviour while using composite data types. > Empty strings will be returned as None instead of '' in Python. > > For example: > > sql> CREATE TYPE testtype AS (id INT, label TEXT); > > python> import psycopg2 > python> import psycopg2.extras > python> db = psycopg2.connect(...) > python> caster = psycopg2.extras.register_composite('testtype', db) > python> cursor = db.cursor() > python> cursor.execute("SELECT (1, '')::testtype") > python> cursor.fetchone()[0] > testtype(id=1, label=None) > > Is this behaviour intended? Or is there some flag I don't know about (I > have found none) that gives me empty strings instead? No, I'm afraid it's a bug. Could you please open a ticket in the tracker? I'll take a look at it this evening. -- Daniele
В списке psycopg по дате отправления: