Function with record type as argument

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: pgsqlnovice <pgsql-novice(at)postgresql(dot)org>
Subject: Function with record type as argument
Date: 2005-02-22 12:26:39
Message-ID: 009E963D-84CD-11D9-A6C7-000D933565E8@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

In a followup to an earlier question from today from another person, is
it possible to create and use a function that takes as input a generic
"record"? Specifically, how would I use a function like:

create or replace function perl_columns(record) returns text as $a$
my ($rec)=(at)_;
my $xml_ex = '';
foreach my $tag (keys %$rec) {
$xml_ex = "<$tag>" . $rec->{$tag} . "</$tag>\n";
}
return $xml_ex;
$a$ language plperlu;

Thanks,
Sean

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message john-paul delaney 2005-02-22 12:44:31 Re: Query combination query.
Previous Message john-paul delaney 2005-02-22 11:20:38 Query combination query.