From: | Alex <alex(at)meerkatsoft(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Help with plperl |
Date: | 2005-08-21 17:58:25 |
Message-ID: | 4308C0C1.9000602@meerkatsoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
could anyone help me with a problem I am having creating a plperl function.
The return always complains with the following error:
composite-returning Perl function must return reference to hash
Thanks
Alex
CREATE TYPE sometype AS
( jid INTEGER,
start_time TEXT,
descr TEXT
);
CREATE OR REPLACE FUNCTION testq() RETURNS sometype AS $$
my $results = [];
my $query = "SELECT jid, start_time FROM schedule LIMIT 10";
$rv = spi_exec_query($query);
elog(INFO, "QUERY: $query");
elog(INFO, "ROWS: $rv->{processed}");
for ( $i = 0; $i < $rv->{processed}; $i++ ) {
my $row = $rv->{rows}[$i];
push @$results, { jid => $row->{jid},
start_time => $row->{start_time},
descr => 'Test' };
}
return $results;
$$ LANGUAGE plperl;
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2005-08-21 20:18:16 | Re: Help with plperl |
Previous Message | Tom Lane | 2005-08-21 17:36:49 | Re: extract (dow/week from date) |