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;



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to