pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerardo Herzig <gherzig@fmed.uba.ar>
To: Jasen Betts <jasen@xnet.co.nz>
Cc: pgsql-sql@postgresql.org
Subject: Re: cast record type to array?
Date: Fri, 28 May 2010 17:14:19 -0300
Message-ID: <4C00241B.3020604@fmed.uba.ar> (raw)
In-Reply-To: <hto617$qf1$3@reversiblemaps.ath.cx>
References: <4BFD9A6C.1060203@fmed.uba.ar>
	<hto617$qf1$3@reversiblemaps.ath.cx>

Jasen Betts wrote:
> On 2010-05-26, Gerardo Herzig <gherzig@fmed.uba.ar> wrote:
>> Hi all. Im not being able to cast a record variable into an array.
>>
>> Im writing a trigger, and i would like to store NEW (and OLD) as text[].
>> There is a way to do it in plpgsql? (w/o any contrib modules)
> 
> why not store them as text instead?
> 
>   new::text 
>   
> is a valid cast.
> 
> 
Hi Jasen. Storing the record in text format will difficult furter
analisis (p.e.searching columns with differences between OLD and NEW).

It will not be easy to play with NEW as string for obtaining each column
values (string_to_array will not work, the values for NEW can be anything)

As this trigger will save information for audit, it is important to get
it right.
Even worst, im *strongly encouraged* not to use any other language
except plpgsql, so i cant use plpythonu, in wich will be trivial to do so.

thanks for your time, Jasen

Gerardo



view thread (3+ messages)

Message-ID: <4C00241B.3020604@fmed.uba.ar>
Permalink:  ../4C00241B.3020604@fmed.uba.ar/
Also on:    postgresql.org/message-id/4C00241B.3020604@fmed.uba.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gherzig@fmed.uba.ar, jasen@xnet.co.nz
  Subject: Re: cast record type to array?
  In-Reply-To: <4C00241B.3020604@fmed.uba.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox