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 1nk6p5-0003L0-2M for pgsql-general@arkaria.postgresql.org; Thu, 28 Apr 2022 16:16: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 1nk6p1-0003DQ-GL for pgsql-general@arkaria.postgresql.org; Thu, 28 Apr 2022 16:16:51 +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 1nk6p1-00038Z-4i for pgsql-general@lists.postgresql.org; Thu, 28 Apr 2022 16:16:51 +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 1nk6ov-0002s1-HY for pgsql-general@lists.postgresql.org; Thu, 28 Apr 2022 16:16:47 +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 23SGGdec019297; Thu, 28 Apr 2022 12:16:40 -0400 From: Tom Lane To: "Burke, William J Collins" cc: "pgsql-general@lists.postgresql.org" Subject: Re: ERROR: cursor variable must be a simple variable (LINE XX: OPEN vQuery.cursorReturn FOR ) In-reply-to: References: Comments: In-reply-to "Burke, William J Collins" message dated "Thu, 28 Apr 2022 15:03:11 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19295.1651162599.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 28 Apr 2022 12:16:39 -0400 Message-ID: <19296.1651162599@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Burke, William J Collins" writes: > I encountered the following error when compiling a pgsql function after = an upgrade from PostgresSQL 9.3 on RHEL7 to PostgreSQL 12.9 on RHEL8, and = could use some help from the community to figure out why. > ERROR: cursor variable must be a simple variable > LINE XX: OPEN vQuery.cursorReturn FOR > ^ > Based on the statement highlighted above, I understand the error message= . However, what I cannot figure out is why we did not get this error durin= g compilation on PostgreSQL 9.3 with RHEL. Why does it work on PG9.3, but = not on PG12? I feel like I am missing something. Hmm, that error check looks about the same as it did then: it's insisting that the datum be of PLPGSQL_DTYPE_VAR type. I think the behavior change is a side-effect of the refactoring that was done awhile back to unify the treatment of row (named-composite-type) variables with RECORD variables. A field of a row was a separate variable back then, but now it isn't. I don't recall whether we noticed this behavior change at the time, but given the pre-existing documentation disclaimer, I'm not too sad about it. If somebody did want to relax this restriction, the thing to do would be to remove the datum type limitation altogether, not just restore bug compatibility with the old behavior. regards, tom lane