pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcast record type to array?
3+ messages / 2 participants
[nested] [flat]
* cast record type to array?
@ 2010-05-26 22:02 Gerardo Herzig <gherzig@fmed.uba.ar>
0 siblings, 1 reply; 3+ messages in thread
From: Gerardo Herzig @ 2010-05-26 22:02 UTC (permalink / raw)
To: pgsql-sql
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)
thanks!
Gerardo
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: cast record type to array?
@ 2010-05-28 10:31 Jasen Betts <jasen@xnet.co.nz>
parent: Gerardo Herzig <gherzig@fmed.uba.ar>
0 siblings, 1 reply; 3+ messages in thread
From: Jasen Betts @ 2010-05-28 10:31 UTC (permalink / raw)
To: pgsql-sql
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: cast record type to array?
@ 2010-05-28 20:14 Gerardo Herzig <gherzig@fmed.uba.ar>
parent: Jasen Betts <jasen@xnet.co.nz>
0 siblings, 0 replies; 3+ messages in thread
From: Gerardo Herzig @ 2010-05-28 20:14 UTC (permalink / raw)
To: Jasen Betts <jasen@xnet.co.nz>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2010-05-28 20:14 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-05-26 22:02 cast record type to array? Gerardo Herzig <gherzig@fmed.uba.ar>
2010-05-28 10:31 ` Jasen Betts <jasen@xnet.co.nz>
2010-05-28 20:14 ` Gerardo Herzig <gherzig@fmed.uba.ar>
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