Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type - Mailing list pgsql-general

From Tom Lane
Subject Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type
Date
Msg-id 3575571.1628543627@sss.pgh.pa.us
Whole thread Raw
In response to Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type  (Bryn Llewellyn <bryn@yugabyte.com>)
Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-general
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



pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type
Next
From: Christophe Pettus
Date:
Subject: archive_command / single user mode