От: Matthew Wakeling
Тема: Re: plpgsql arrays
Дата: ,
Msg-id: alpine.DEB.2.00.0904071630420.791@aragorn.flymine.org
(см: обсуждение, исходный текст)
Ответ на: Re: plpgsql arrays  (justin)
Ответы: Re: plpgsql arrays  (justin)
Re: plpgsql arrays  (Tom Lane)
Список: pgsql-performance

Скрыть дерево обсуждения

plpgsql arrays  (Matthew Wakeling, )
 Re: plpgsql arrays  (Robert Haas, )
  Re: plpgsql arrays  (Matthew Wakeling, )
   Re: plpgsql arrays  (Tom Lane, )
    Re: plpgsql arrays  (Matthew Wakeling, )
     Re: plpgsql arrays  (Tom Lane, )
      Re: plpgsql arrays  (Matthew Wakeling, )
       Re: plpgsql arrays  (Matthew Wakeling, )
       Re: plpgsql arrays  (Tom Lane, )
        Re: plpgsql arrays  (Matthew Wakeling, )
        Re: plpgsql arrays  (Nathan Boley, )
    Re: plpgsql arrays  (Simon Riggs, )
     Re: plpgsql arrays  (Alvaro Herrera, )
     Re: plpgsql arrays  (Tom Lane, )
      Re: plpgsql arrays  (Matthew Wakeling, )
     Re: plpgsql arrays  (Matthew Wakeling, )
      Re: plpgsql arrays  (Robert Haas, )
 Re: plpgsql arrays  (Tom Lane, )
  Re: plpgsql arrays  (Matthew Wakeling, )
   Re: plpgsql arrays  (justin, )
    Re: plpgsql arrays  (Matthew Wakeling, )
     Re: plpgsql arrays  (justin, )
     Re: plpgsql arrays  (Tom Lane, )
      Re: plpgsql arrays  (Matthew Wakeling, )
   Re: plpgsql arrays  (Merlin Moncure, )
    Re: plpgsql arrays  (Tom Lane, )
     Re: plpgsql arrays  (Matthew Wakeling, )
      Re: plpgsql arrays  (Tom Lane, )
 Re: plpgsql arrays  (Merlin Moncure, )
  Re: plpgsql arrays  (Merlin Moncure, )
   Re: plpgsql arrays  (Matthew Wakeling, )
    Re: plpgsql arrays  (Merlin Moncure, )

On Tue, 7 Apr 2009, justin wrote:
>> What would be the syntax for putting a single row from a cursor into a
>> variable? I have tried:
>>
>> FETCH INTO left left_cursor;
>>
>> which says syntax error, and
>>
>> left = FETCH left_cursor;
>>
>> which gives the error 'ERROR:  missing datatype declaration at or near "="'
>
> Have to declare Left variable  as record data type declaration part of the
> function

It is.

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;

Matthew

--
"Prove to thyself that all circuits that radiateth and upon which thou worketh
 are grounded, lest they lift thee to high-frequency potential and cause thee
 to radiate also. "             -- The Ten Commandments of Electronics


В списке pgsql-performance по дате сообщения:

От: Tom Lane
Дата:
Сообщение: Re: plpgsql arrays
От: Bruce Momjian
Дата:
Сообщение: Re: 8.4 Performance improvements: was Re: Proposal of tunable fix for scalability of 8.4