Page 1 of 1

MAX of empty set causes internal error (sometimes)

Posted: Mon Mar 23, 2009 2:27 pm
by HughDarwen
The current value of relvar SP is
RELATION {S# CHARACTER, P# CHARACTER, Qty INTEGER} {
TUPLE {S# "S1", P# "P1", Qty 300},
TUPLE {S# "S1", P# "P2", Qty 200},
TUPLE {S# "S1", P# "P3", Qty 400},
TUPLE {S# "S1", P# "P4", Qty 200},
TUPLE {S# "S1", P# "P5", Qty 100},
TUPLE {S# "S1", P# "P6", Qty 100},
TUPLE {S# "S2", P# "P1", Qty 300},
TUPLE {S# "S2", P# "P2", Qty 400},
TUPLE {S# "S3", P# "P2", Qty 200},
TUPLE {S# "S4", P# "P2", Qty 200},
TUPLE {S# "S4", P# "P4", Qty 300},
TUPLE {S# "S4", P# "P5", Qty 400}

MAX(SP, S#) yields, correctly, 'S4'.

MAX(SP WHERE FALSE, S#) gives rise to this:
RelTransaction: abort failed: com.sleepycat.je.DatabaseException: (JE 3.3.69) Transaction 2151 detected open cursors while aborting

But this doesn't always happen with MAX of the empty set. For example:
max (RELATION { S# CHAR }{ }, S#)

ERROR: null

Re: MAX of empty set causes internal error (sometimes)

Posted: Tue Mar 24, 2009 1:31 pm
by Dave
It's a bug in the mechanism that's supposed to generate an error message for MAX, MIN, UNION, D_UNION, and INTERSECT when performed on relations of cardinality zero. Instead of "ERROR: null" or an internal error, it's supposed to print:

Code: Select all

max (relation {x integer} {}, x) 
 
ERROR: Result of MAX on no values is undefined.

Line 1
I'll hopefully have this fixed shortly.

Re: MAX of empty set causes internal error (sometimes)

Posted: Wed Mar 25, 2009 1:24 am
by Dave
This has been fixed in version 0.3.14.