At 09:03 PM 1/15/00 -0500, Tom Lane wrote:
>What I think we need is to add a new parsetree node type that explicitly
>represents a CAST operator, and then modify parse_expr.c to transform
>that node type into an appropriate function call (or, perhaps, nothing
>at all if the source value is already the right type).
>
>Comments?
Well, I hate to keep popping up wearing my compiler-writer hat, but
yes, this seems obvious. If the casting notation includes type
modifications like precision information then the simple expression
type_name(expr) can't ever match it. The casting notation must be
rejected or properly executed. Silent errors of this type are simply
unforgivable. Either an error or a proper transformation (presumably
to a function that takes precision and scale parameters) is fine, but
silent and incorrect execution is a major sin.
- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert
Serviceand other goodies at http://donb.photo.net.