Tom Lane wrote:
Richard Huxton <dev@xxxxxxxxxxxx> writes:
[ proof that cast(123 as char) actually produces varchar in mysql ]
Egad. I wonder if they think this is a feature?
Well, presumably its what all the other "convenient" (for Ken's
particular problem) databases do. The only alternative I could see would
be to use a varchar while casting values and then check lengths at the
end before re-casting to e.g. char(6).
Interestingly, it must have some lookup table mapping numeric types to
lengths of varchar because a standard int gives you varchar(11) whereas
an expression that pushes you beyond 32 bits gives varchar(32) and a
tinyint gives you varchar(4). Clearly some thought has gone into this.
--
Richard Huxton
Archonet Ltd
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
message can get through to the mailing list cleanly