Re: [INTERFACES] libpgtcl and array fields return format - PROPOSAL - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: [INTERFACES] libpgtcl and array fields return format - PROPOSAL
Date
Msg-id 7653.934382778@sss.pgh.pa.us
Whole thread Raw
In response to libpgtcl and array fields return format - PROPOSAL  (Constantin Teodorescu <teo@flex.ro>)
List pgsql-interfaces
Constantin Teodorescu <teo@flex.ro> writes:
> In libpgtcl, pg_select an array field is return as the following string:
> {"red","blue","green"}
> and it's rather difficult to process them as a normal tcl list.

> I think it would be better to return the string as:
> "red" "blue" "green"
> and tcl users could directly process the array as an ordinary tcl list.

Only problem is, how do you know when to make the transformation?
It's not that easy to tell in libpq/libpgtcl whether a column has
array type or not, and I think stripping '{' ... '}' off a plain
text value would be a big no-no.

As you noticed later, there is some optional TCL_ARRAYS code that
purports to do something like this, but I think it's pretty broken.

What seems like it would be fairly safe is to introduce separate Tcl
functions that convert between Postgres array format and Tcl list
format, and leave it to the user to apply these functions to data that
he knows is arrays...
        regards, tom lane


pgsql-interfaces by date:

Previous
From: Constantin Teodorescu
Date:
Subject: Re: [INTERFACES] Regarding selction of query
Next
From: Constantin Teodorescu
Date:
Subject: Re: [INTERFACES] libpgtcl and array fields return format - PROPOSAL