public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Russell Rose | Passfield Data Systems <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Get error when calling function that returns a table
Date: Mon, 25 Mar 2024 12:26:43 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <VI1P191MB0638AA48C8FA4AC3CC71B5B9F2362@VI1P191MB0638.EURP191.PROD.OUTLOOK.COM>
References: <VI1P191MB0638AA48C8FA4AC3CC71B5B9F2362@VI1P191MB0638.EURP191.PROD.OUTLOOK.COM>
Russell Rose | Passfield Data Systems <[email protected]> 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
view thread (2+ messages)
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: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Get error when calling function that returns a table
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox