On 05/01/16 14:37, Dmitry Yemanov wrote: > These examples say nothing about the approach used there: either > literals are VARCHARs, or CASE derives the datatype differenly, or both. > > And I suppose Firebird is not really alone, see for MariaDB: > > CASE ... THEN 'a' ... THEN 'abcd' ... ELSE 'abc' END > > will return a result with a <data type> of CHAR(4), because <character > string literal>s are fixed-length character strings and the size of the > largest aggregated <literal> is 4 characters.
But if you pass in a CHAR(3), surely you should get a CHAR(3) back? Otherwise, your literal isn't really a literal because its datatype has been changed? Okay, I know sanity often doesn't enter into it when defining specifications, but requiring all literals to be forced to the same datatype does seem to be a fairly insane example :-) (And as I read the spec, if CASE has a varchar in it somewhere, it can return a varchar, so why not always return a varchar. Especially if, again as I read it, if you mix char and varchar you will actually get the desired result.) So if we're changing the datatype anyway, we might as well change it to varchar. Cheers, Wol ------------------------------------------------------------------------------ Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel