pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthew Wakeling <matthew@flymine.org>
Cc: justin <justin@emproshunts.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: plpgsql arrays
Date: Tue, 07 Apr 2009 12:08:13 -0400
Message-ID: <16186.1239120493@sss.pgh.pa.us> (raw)
In-Reply-To: <alpine.DEB.2.00.0904071630420.791@aragorn.flymine.org>
References: <alpine.DEB.2.00.0904031420470.21772@aragorn.flymine.org>
	<28757.1238767715@sss.pgh.pa.us>
	<alpine.DEB.2.00.0904071616350.791@aragorn.flymine.org>
	<49DB700F.8020108@emproshunts.com>
	<alpine.DEB.2.00.0904071630420.791@aragorn.flymine.org>

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 BY objectid, 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



view thread (32+ messages)  latest in thread

Message-ID: <16186.1239120493@sss.pgh.pa.us>
Permalink:  ../16186.1239120493@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16186.1239120493@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, matthew@flymine.org, justin@emproshunts.com
  Subject: Re: plpgsql arrays
  In-Reply-To: <16186.1239120493@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox