View Single Post

   
  #1 (permalink)  
Old 04-17-2008, 09:31 PM
Sean Davis
 
Posts: n/a
Default Function with record type as argument

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)=@_;
my $xml_ex = '';
foreach my $tag (keys %$rec) {
$xml_ex = "<$tag>" . $rec->{$tag} . "</$tag>\n";
}
return $xml_ex;
$a$ language plperlu;

Thanks,
Sean


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote