MAX of empty set causes internal error (sometimes)
Posted: Mon Mar 23, 2009 2:27 pm
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
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