Thread: Cursor on an INTERSECT query assertion fails

Cursor on an INTERSECT query assertion fails

From
"Heikki Linnakangas"
Date:
On CVS HEAD:

postgres=# SELECT a INTO foo1 from generate_series(1,100) a;
SELECT
postgres=# SELECT a INTO foo2 from generate_series(51,150) a;
SELECT
postgres=# DECLARE  setopcur SCROLL CURSOR FOR SELECT * FROM foo1
intersect SELECT * FROM foo2;
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

From the log:

TRAP: FailedAssertion("!(parse->utilityStmt == ((void *)0))", File:
"prepunion.c", Line: 114)

(the above is actually supposed to throw an "not in a transaction block"
error, but you get the same result with a BEGIN in there.)

ISTM the Assertion is just bogus, and can be removed.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

Re: Cursor on an INTERSECT query assertion fails

From
Tom Lane
Date:
"Heikki Linnakangas" <heikki@enterprisedb.com> writes:
> TRAP: FailedAssertion("!(parse->utilityStmt == ((void *)0))", File:
> "prepunion.c", Line: 114)

> ISTM the Assertion is just bogus, and can be removed.

Good catch --- this used to be OK but I'd changed the parsetree
representation of DECLARE CURSOR, so it's now bogus.  Removed.

            regards, tom lane