| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Sim Zacks <sim(at)compulab(dot)co(dot)il> |
| Cc: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, Sandy Oz <alexandra(at)compulab(dot)co(dot)il> |
| Subject: | Re: numeric cast oddity |
| Date: | 2009-12-06 15:10:36 |
| Message-ID: | 23294.1260112236@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Sim Zacks <sim(at)compulab(dot)co(dot)il> writes:
> If I replace that column with -1::numeric(20,4) or - (1::numeric(20,4))
> the type that goes to the view is numeric without any scale or precision
> and then I get an error that I cannot change the column type.
You've still got the order of operations wrong.
(-1)::numeric(20,4)
is known to have typmod (20,4), because the cast operation enforces it.
- (1::numeric(20,4))
is not known to have any particular typmod --- it actually does fit in
(20,4), of course, but that fact depends on the detailed behavior of the
minus operator, which is not known to the type machinery.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Scott Marlowe | 2009-12-06 16:34:05 | Re: Error in crosstab using date_trunc |
| Previous Message | José María Terry Jiménez | 2009-12-06 11:56:20 | Re: Error in crosstab using date_trunc |