Re: ERROR: cursor variable must be a simple variable (LINE XX: OPEN vQuery.cursorReturn FOR ) - Mailing list pgsql-general

From Tom Lane
Subject Re: ERROR: cursor variable must be a simple variable (LINE XX: OPEN vQuery.cursorReturn FOR )
Date
Msg-id 19296.1651162599@sss.pgh.pa.us
Whole thread Raw
In response to ERROR: cursor variable must be a simple variable (LINE XX: OPEN vQuery.cursorReturn FOR )  ("Burke, William J Collins" <William.Burke@collins.com>)
List pgsql-general
"Burke, William J                            Collins" <William.Burke@collins.com> writes:
> I encountered the following error when compiling a pgsql function after an upgrade from PostgresSQL 9.3 on RHEL7 to
PostgreSQL12.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
didnot get this error during compilation on PostgreSQL 9.3 with RHEL. Why does it work on PG9.3, but not on PG12? I
feellike 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



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Backing up a DB excluding certain tables
Next
From: Shaozhong SHI
Date:
Subject: Re: parallel-processing multiple similar query tasks - any example?