Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDCap-0004en-9M for pgsql-general@arkaria.postgresql.org; Mon, 09 Aug 2021 21:13:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mDCan-00066M-8o for pgsql-general@arkaria.postgresql.org; Mon, 09 Aug 2021 21:13:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDCam-00066E-Vs for pgsql-general@lists.postgresql.org; Mon, 09 Aug 2021 21:13:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDCak-0003mG-Er for pgsql-general@lists.postgresql.org; Mon, 09 Aug 2021 21:13:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 179LDldD3575572; Mon, 9 Aug 2021 17:13:47 -0400 From: Tom Lane To: Pavel Stehule cc: Bryn Llewellyn , pgsql-general list Subject: Re: PL/pgSQL: Spurious 22P02 error on "select col into var" when col is user-defined type In-reply-to: References: <4FC8BC35-0048-406D-9BFD-774D7963D31F@yugabyte.com> Comments: In-reply-to Pavel Stehule message dated "Mon, 09 Aug 2021 22:44:13 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3575570.1628543627.1@sss.pgh.pa.us> Date: Mon, 09 Aug 2021 17:13:47 -0400 Message-ID: <3575571.1628543627@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Stehule 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