Re: [INTERFACES] libpgtcl and array fields return format - PROPOSAL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Constantin Teodorescu <teo(at)flex(dot)ro>
Cc: PostgreSQL Interfaces <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: Re: [INTERFACES] libpgtcl and array fields return format - PROPOSAL
Date: 1999-08-11 14:46:18
Message-ID: 7653.934382778@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Constantin Teodorescu <teo(at)flex(dot)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

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Constantin Teodorescu 1999-08-11 15:01:21 Re: [INTERFACES] libpgtcl and array fields return format - PROPOSAL
Previous Message Constantin Teodorescu 1999-08-11 14:27:06 Re: [INTERFACES] Regarding selction of query