#141 ✓ resolved
Psycopg website

empty string in composite data types

Reported by Psycopg website | December 3rd, 2012 @ 01:51 PM

Submitted by: Christian von Kietzell

Psycopg incorrectly returns empty strings in composite data types as None instead of ''.

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)

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins