Re: [Sqlrelay-discussion] getColumnType returns 'UNKNOWN' for PostgreSQL ARRAY column type.
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2007-09-07 15:27:15
|
This should be simple to fix. I'm looking into it now and I'll let you
know what I find shortly.
Dave
dav...@fi...
On Wed, 2007-09-05 at 16:29 -0400, Alfred J Fazio 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...
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________ Sqlrelay-discussion mailing list Sql...@li... https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
|