From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Bryn Llewellyn <bryn@yugabyte.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type
Date: Mon, 09 Aug 2021 17:13:47 -0400
Message-ID: <3575571.1628543627@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFj8pRC0j4hSK=j-NHSRkS7LYSzc=A746pvoc+U6ss7QRJJo0A@mail.gmail.com>
References: <4FC8BC35-0048-406D-9BFD-774D7963D31F@yugabyte.com>
<CAFj8pRC0j4hSK=j-NHSRkS7LYSzc=A746pvoc+U6ss7QRJJo0A@mail.gmail.com>
Pavel Stehule <pavel.stehule@gmail.com> writes:
> Some errors like this, but not this can be detected by plpgsql_check
> https://github.com/okbob/plpgsql_check - probably the heuristic for type
> check is not complete.
STRICTMULTIASSIGNMENT would detect most cases of this, except that
the condition is checked too late. We'd need to count the fields
*before* trying to assign values, not after.
In the meantime, it does seem like the docs could be more explicit
about this, and perhaps give an example showing the (x).* solution.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, pavel.stehule@gmail.com, bryn@yugabyte.com
Subject: Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type
In-Reply-To: <3575571.1628543627@sss.pgh.pa.us>
References: <4FC8BC35-0048-406D-9BFD-774D7963D31F@yugabyte.com> <CAFj8pRC0j4hSK=j-NHSRkS7LYSzc=A746pvoc+U6ss7QRJJo0A@mail.gmail.com> <3575571.1628543627@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox