Search Postgresql Archives

Help with plperl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux