Re: [Sqlrelay-discussion] getColumnType returns 'UNKNOWN' for PostgreSQL ARRAY column type.
Brought to you by:
mused
|
From: Alfred J F. <alf...@gm...> - 2007-09-05 21:07:05
|
I noticed that I was running an old version of SQLRelay. I have installed
version 0.39.2 and get the same results. Just FYI :). Since I'm already
bugging the list, I must say I'm surprised that there is no API call (at
least in Python) to find out the current version of the SQLRelay client. I
guess nobody has had a need for it?
Cheers
On 9/5/07, Alfred J Fazio <alf...@gm...> wrote:
>
> Hi everyone,
>
> I am using SQLRelay 0.38 via Python (2.4.4) to connect to a PostgreSQL
> (8.1.9) database. I have noticed that if I create a table with an ARRAY
> column, that Sqlrelay returns the column type as UNKNOWN. E.g., if I
> issue the following SQL:
>
> CREATE TABLE test (arr TEXT[][]);
>
> And fill it will some test data:
>
> INSERT INTO test (arr) VALUES (ARRAY[['fname', 'alfred'], ['lname',
> 'fazio'], ['age', '24'], ['employer', 'smoothstone']]);
>
> I will get an UNKNOWN value when calling getColumnType on the arr column
> above:
>
> >>> c.sendQuery("SELECT arr FROM test")
> >>> c.getField(0, 0)
> '{{fname,alfred},{lname,fazio},{age,24},{employer,smoothstone}}'
> >>> c.getColumnType(0)
> 'UNKNOWN'
>
> It would be very convenient if I could test whether the column I am
> fetching is an ARRAY. If so, I can automatically parse the result of the
> query into a native Python list. I briefly peeked in the source code and
> saw that there has been a datatype declared for arrays for PostgreSQL in the
> src/common/datatypes.h file (called 'ANYARRAY'). However, I didn't look
> around for long to see where I might implement the code needed to detect the
> column type. Could somebody please point me to the right direction within
> the source code where I can perhaps add a clause for this situation? I will
> then be happy to submit a patch to the list.
>
> Thanks for your time!
>
> --
> Alfred J Fazio,
> alf...@gm...
--
Alfred J Fazio,
alf...@gm...
|