From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] I think we need an explicit parsetree node for CAST |
Date: | 2000-01-16 02:41:09 |
Message-ID: | 200001160241.VAA27171@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> These particular cases can be fixed with a one-line patch, I think,
> because there is storage in an A_Const node to hold a reference to
> a Typename, which includes typmod. parse_expr.c is just forgetting
> to pass the typmod to parser_typecast().
>
> BUT: there isn't any equally simple patch when the value being casted
> is not a constant. For instance
>
> select field1 :: numeric(7,2) from table1;
>
> cannot work properly now, because gram.y transforms it into
>
> select numeric(field1) from table;
>
> which (a) drops the typmod and (b) bypasses all of the intelligence
> that should be used to determine how to coerce the type.
>
> 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).
Actually, I think I never made the additional atttypmod changes because
no one had ever reported a problem, and I was confused by that.
--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2000-01-16 04:05:30 | Re: [HACKERS] INDEX_MAX_KEYS and pg_dump |
Previous Message | Bruce Momjian | 2000-01-16 02:37:06 | Re: [HACKERS] I think we need an explicit parsetree node for CAST |