pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Burke, William J Collins <William.Burke@collins.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: ERROR: cursor variable must be a simple variable (LINE XX: OPEN vQuery.cursorReturn FOR )
Date: Thu, 28 Apr 2022 12:16:39 -0400
Message-ID: <19296.1651162599@sss.pgh.pa.us> (raw)
In-Reply-To: <PH1P110MB104966C71F933FBCA4B99D9DF3FD9@PH1P110MB1049.NAMP110.PROD.OUTLOOK.COM>
References: <PH1P110MB1049B1AFDEB1EB5115200A35F3FA9@PH1P110MB1049.NAMP110.PROD.OUTLOOK.COM>
	<PH1P110MB104966C71F933FBCA4B99D9DF3FD9@PH1P110MB1049.NAMP110.PROD.OUTLOOK.COM>

"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 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 during 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





view thread (3+ messages)

Message-ID: <19296.1651162599@sss.pgh.pa.us>
Permalink:  ../19296.1651162599@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19296.1651162599@sss.pgh.pa.us

 · 

reply

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, William.Burke@collins.com
  Subject: Re: ERROR: cursor variable must be a simple variable (LINE XX: OPEN vQuery.cursorReturn FOR )
  In-Reply-To: <19296.1651162599@sss.pgh.pa.us>
  References: <PH1P110MB1049B1AFDEB1EB5115200A35F3FA9@PH1P110MB1049.NAMP110.PROD.OUTLOOK.COM> <PH1P110MB104966C71F933FBCA4B99D9DF3FD9@PH1P110MB1049.NAMP110.PROD.OUTLOOK.COM> <19296.1651162599@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