public inbox for [email protected]
help / color / mirror / Atom feedFrom: Michael Nolan <[email protected]>
To: [email protected] <[email protected]>
Subject: Declaring a field that is also an out parameter in a function
Date: Sat, 6 Jul 2024 16:29:12 -0500
Message-ID: <CAOzAquKPXRWp38u9cURDCd4XzKCbKLhuZvH6AQjtXGW3R6-LoQ@mail.gmail.com> (raw)
In the following short code, the out parameter d3 is also declared, so
its value will be null in the output.
create or replace function public.test_function(in varchar, in char, in date, ou
t d1 text, out d2 integer, out d3 char, out d4 date )
stable as $$
DECLARE
wk_intxt alias for $1;
wk_inchar alias for $2;
wk_indate alias for $3;
d3 char;
BEGIN
d1 := 'foo,bar';
d2 := 15;
d3 := 'X';
d4 := current_date;
END
$$ language 'plpgsql';
Here's what happens in 16.1:
psql (16.1)
Type "help" for help.
uscf=> select test_function('1234','a','2024-01-01')
uscf-> \g
test_function
----------------------------
("foo,bar",15,,2024-07-06)
(1 row)
Shouldn't declaring a field that is also an OUT parameter throw an error?
Mike Nolan
[email protected]
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]
Subject: Re: Declaring a field that is also an out parameter in a function
In-Reply-To: <CAOzAquKPXRWp38u9cURDCd4XzKCbKLhuZvH6AQjtXGW3R6-LoQ@mail.gmail.com>
* 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