Skip to content

inconsistent results with minvalue/maxvalue and date/timestamp arguments #8784

@tonne1

Description

@tonne1

minvalue/maxvalue with date/timestamp arguments behave inconsistent in several ways:

  • re argument count
  • re argument sequence
  • different behaviour vs earlier versions when used in join condition

Tested with Firebird 5.0.3 1683, 5.0.1 and 4.0.4, SS, Win11

  1. Inconsistent behaviour depending on argument count and/or argument sequence:
-- ok
select maxvalue(current_date, current_timestamp, current_timestamp) from rdb$database

-- datatypes are not comparable
select maxvalue(current_date, current_date, current_timestamp) from rdb$database

-- ok
select maxvalue(current_timestamp, current_date, current_timestamp) from rdb$database

-- datatypes are not comparable
select maxvalue(current_date, current_timestamp) from rdb$database
  1. Changed behaviour vs former versions when used in join condition:
-- conversion error with 5.0.3 1683, but ok with version 4.0.4 und 5.0.1
select 1
from rdb$database a
join rdb$database b on maxvalue(current_date, current_timestamp, current_timestamp) >= current_date;

-- datatypes are not comparable
select 1
from rdb$database a
join rdb$database b on maxvalue(current_date, current_timestamp) >= current_date;

Similar results for localtimestamp instead of current_timestamp, and for minvalue:

-- ok
select minvalue('2025-10-14', cast('2025-10-14 03:00:00.000' as timestamp)) from rdb$database;

-- conversion error
select minvalue(cast('2025-10-14' as date), '2025-10-14 03:00:00.000') from rdb$database;
select minvalue(current_date, '2025-10-14 03:00:00.000') from rdb$database;

Part of this could have been caused by fixes for #8304, but the inconsistencies re argument count/sequence seem to be older.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions