Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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


pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group