CAST-FORMAT. Error message for invalid query does not contain name of lost part

49 views
Skip to first unread message

Pavel Zotov

unread,
Jul 4, 2026, 3:31:11 AMJul 4
to firebird-devel

This (weird) query:

select cast('Apr' as date format 'YEAR  MON') from rdb$database;

-- fails with following output:
1) 6.0.0.2052:
Statement failed, SQLSTATE = HY000
Cannot find value in input string for "YEAR" pattern
(gdscode = 335545315)

2) 6.0.0.2060:
Statement failed, SQLSTATE = HY000
Cannot recognize "" part of date format
(gdscode = 335545293)

The first message seems much clearer (and second  does not contain 'year' )
Can it be used as it was before #da137310 , or just to add 'YEAR' incurrent text  ?
// Correct behavior of YEAR pattern (#9052)

Artyom Ivanov

unread,
Jul 6, 2026, 3:58:30 AMJul 6
to firebird-devel
The `YEAR` pattern has been re-implemented: it now converts a year number to a spelled version (`ONE THOUSAND ONE HUNDRED`) as it done in Oracle.
Currently, the 'YEAR' is implemented only for `datetime to string` conversion (as it done in Oracle), it means `YEAR` has been removed for `string to datetime` conversion, and therefore the new error message is correct, but there is something wrong with the message argument (empty quotes), I will fix it.

Artyom Ivanov

unread,
Jul 14, 2026, 10:37:30 AM (13 days ago) Jul 14
to firebird-devel
I created PR with a clearer error message, can you test it please?

Pavel Zotov

unread,
Jul 14, 2026, 1:46:07 PM (13 days ago) Jul 14
to firebird-devel
I created PR with a clearer error message, can you test it please?
...

1) 6.0.0.2052:
Statement failed, SQLSTATE = HY000
Cannot find value in input string for "YEAR" pattern
(gdscode = 335545315)

2) 6.0.0.2060:
Statement failed, SQLSTATE = HY000
Cannot recognize "" part of date format
(gdscode = 335545293)


Now this query issues:

C:\FB\60SC>echo select cast('Apr' as date format 'YEAR  MON') from rdb$database; | isql /:employee -z
ISQL Version: WI-T6.0.0.2074 Firebird 6.0 Initial
Server version:
WI-T6.0.0.2074 Firebird 6.0 Initial
WI-T6.0.0.2074 Firebird 6.0 Initial/tcp (PZ)/P20:C
WI-T6.0.0.2074 Firebird 6.0 Initial/tcp (PZ)/P20:C

       CAST
===========

Statement failed, SQLSTATE = HY000
Cannot recognize "EAR" part of date format

(trace:  335545293 : Cannot recognize "EAR" part of date format )

Dimitry Sibiryakov

unread,
Jul 14, 2026, 3:09:51 PM (13 days ago) Jul 14
to firebir...@googlegroups.com
Pavel Zotov wrote 14.07.2026 19:46:
> Statement failed, SQLSTATE = HY000
> Cannot recognize "EAR" part of date format

And this is kinda right error message because "Y" is a valid format for
one-digit year and no delimiter between parts is required, so "YMMDD", for
example, is a valid pattern.

--
WBR, SD.

Artyom Ivanov

unread,
Jul 14, 2026, 4:40:47 PM (13 days ago) Jul 14
to firebird-devel
That's correct.
Reply all
Reply to author
Forward
0 new messages