Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA09662 for ; Wed, 11 Aug 1999 10:47:38 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id KAA07655; Wed, 11 Aug 1999 10:46:18 -0400 (EDT) To: Constantin Teodorescu cc: PostgreSQL Interfaces Subject: Re: [INTERFACES] libpgtcl and array fields return format - PROPOSAL In-reply-to: Your message of Wed, 11 Aug 1999 06:26:23 +0000 <37B1178F.1BDFB003@flex.ro> Date: Wed, 11 Aug 1999 10:46:18 -0400 Message-ID: <7653.934382778@sss.pgh.pa.us> From: Tom Lane Constantin Teodorescu 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