Thread: SRF problem

SRF problem

From
Együd Csaba
Date:
(Sorry if it arrives twice.)

>
> Hi All,
> I'd like to write an SRF but I'm block a strange error message
>
> WARNING:  plpgsql: ERROR during compile of check_close2 near line 11
> ERROR:  return type mismatch in function returning tuple at
> or near ";"
>
> I get this message even if the return rowset contains 0 or
> more tuples. What is done wrong?
> The code:
> -----------------------------------------------------------------
> create type CHECK_CLOSE as (
>   prooftype       text,
>   id              int,
>   sn              text,
>   partnername     text,
>   performancedate text,
>   detailcount     int
> );
> ------------------------------------------------------------------
> create or replace function check_close2() returns CHECK_CLOSE AS '
> declare
>   R       CHECK_CLOSE%ROWTYPE;
> begin
>   R.prooftype       := ''INCINV'';
>   R.id              := 1;
>   R.sn              := ''012334'';
>   R.partnername     := ''someone'';
>   R.performancedate := ''2004.02.01'';
>   R.detailcount     := 0;
>   return next R;
>   return;
> end;'
> language 'plpgsql';
> ------------------------------------------------------------------
> select * from check_close2();
> WARNING:  plpgsql: ERROR during compile of check_close2 near line 11
> ERROR:  return type mismatch in function returning tuple at
> or near ";"
>
>
> Thank you very much.
> -- Csaba Együd
>