From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Russell Rose | Passfield Data Systems <russellrose(at)passfield(dot)co(dot)uk> |
Cc: | "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Get error when calling function that returns a table |
Date: | 2024-03-25 16:26:43 |
Message-ID: | 2499067.1711384003@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Russell Rose | Passfield Data Systems <russellrose(at)passfield(dot)co(dot)uk> writes:
> I have got a procedure (test.sql) and this calls a function (test_rr.sql) which returns a table. I use the SQL:
> Call test();
> I get the error:
> ERROR: invalid input syntax for type integer: "(14891,0,"VIMALBA ","P901 ",111.000000)"
> CONTEXT: PL/pgSQL function test() line 13 at FETCH
> SQL state: 22P02
Didn't test, but I think this:
DECLARE my_cur scroll CURSOR FOR
SELECT test_rr() ;
needs to be more like
DECLARE my_cur scroll CURSOR FOR
SELECT * FROM test_rr() ;
As you have it, the cursor produces a single composite column,
which isn't consistent with
FETCH FROM my_cur INTO ret1, ret2, ret3, ret4, ret5 ;
I vaguely recall that plpgsql will sometimes let you be sloppy
about composites versus separate columns, but evidently not here.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | ft | 2024-03-26 21:04:55 | xml build a list of all elements |
Previous Message | Russell Rose | Passfield Data Systems | 2024-03-25 15:43:11 | Get error when calling function that returns a table |