Re: INET type and arrays: too much casting?

Stephane Bortzmeyer <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization NIC France
Message-ID <[email protected]>
On Mon, Sep 15, 2008 at 12:27:49PM +0200,
 Stephane Bortzmeyer <[email protected]> wrote 
 a message of 24 lines which said:

> But if the column has an array type:
> 
> CREATE TABLE Foobar (addr INET[]);
> 
> psycopg2 can no longer insert data:

Same issue with type UUID (new in PostgreSQL 8.3, while INET is much
older):

>>> cursor.execute("""INSERT INTO Barfoo VALUES (%s)""", [['dff1a24c-2ac5-4166-a5dc-7ad76812902f']])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
psycopg2.ProgrammingError: column "addr" is of type uuid[] but expression is of type text[]
HINT:  You will need to rewrite or cast the expression.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.