Re: plpgsql arrays - Mailing list pgsql-performance

From Tom Lane
Subject Re: plpgsql arrays
Date
Msg-id 16186.1239120493@sss.pgh.pa.us
Whole thread Raw
In response to Re: plpgsql arrays  (Matthew Wakeling <matthew@flymine.org>)
Responses Re: plpgsql arrays
List pgsql-performance
Matthew Wakeling <matthew@flymine.org> writes:
> CREATE OR REPLACE FUNCTION overlap_gene_primer() RETURNS SETOF RECORD AS $$
> DECLARE
>      left location;
>      retval RECORD;
> BEGIN
>      DECLARE left_cursor NO SCROLL CURSOR FOR SELECT location FROM location, gene WHERE location.id = gene.id ORDER
BYobjectid, start, end; 
>      left = FETCH left_cursor;
> END;
> $$ LANGUAGE plpgsql;

Well, the DECLARE for the cursor should go in the DECLARE section,
and the syntax for the FETCH should be
    FETCH cursorname INTO recordvariablename;
and I'm too lazy to check right now but I think you might be missing
an OPEN for the cursor.

            regards, tom lane

pgsql-performance by date:

Previous
From: justin
Date:
Subject: Re: plpgsql arrays
Next
From: Andrew Sullivan
Date:
Subject: Re: Best replication solution?