[pgbr-geral] Duvida pl/python
Charles Souza Silva
charcalcado em yahoo.com.br
Sexta Maio 22 11:38:05 BRT 2009
Pessoal estou aprendendo pl/python. Estou fazendo esse exemplo do manual
do postgresql:
CREATE TYPE greeting AS
(how text,
who text);
create or replace function greet (how text)
returns setof greeting
AS $BODY$
return ([how,"World"],[how,"PostgreSQL"])
$BODY$ LANGUAGE plpythonu;
Quando executo Select greet('Ola') ele retorna (Ola,World) e
(Ola,PostgreSQL) certinho.
Agora se eu colocar a funcao dessa forma:
create or replace function greet (how text)
returns setof greeting
AS $BODY$
return ([how,"World"])
$BODY$ LANGUAGE plpythonu;
E executar o mesmo comando "Select greet('Ola')" dá erro :
returned sequence's length must be same as tuple's length
Porque esse erro? Nao pode retornar só uma linha de retorno?
Charles
More information about the pgbr-geral
mailing list