Re: proposal: plpgsql - iteration over fields of rec or row variable

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: plpgsql - iteration over fields of rec or row variable
Date: 2010-11-09 09:38:33
Message-ID: AANLkTin-Aic5+kZ0q2Tjeyaea9_tD6rwm7yKZdgCFPfL@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hey Pavel,

2010/11/9 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>

> > a) transformation to common type
> >
> > + simple - it is one day job - function record_to_array,
> > array_to_record, and fieldnames_to_array
> > - lost of type info, hidden problems with IO cast - int a := 10.0/2.0
> > is a problem
> >
> > using a plperl, pltcl is same like @a
> >
>
> I thinking about some simple API, that can be based on transformation
> to text. It can be enough for almost all.
>
> * text[] = record_to_array(record)
> * table(id, key, datatype, value) = record_to_table(record)
> * text = record_get_field(record, text)
> * record = record_set_field(record, text, anyelement)
>
> ??
>
I personally like it. But I propose to add as well:
integer := record_nkeys();
text := record_get_field(record, integer);

> Pavel
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

--
// Dmitriy.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2010-11-09 10:20:16 Re: CLUSTER can change t_len
Previous Message Itagaki Takahiro 2010-11-09 09:11:59 Re: CLUSTER can change t_len