Re: [HACKERS] I think we need an explicit parsetree node for CAST

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] I think we need an explicit parsetree node for CAST
Date: 2000-01-16 04:07:30
Message-ID: 3.0.1.32.20000115200730.010ac290@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-01-16 04:16:12 pg_dump not in very good shape
Previous Message Bruce Momjian 2000-01-16 04:05:30 Re: [HACKERS] INDEX_MAX_KEYS and pg_dump