Re: [BUGS] Bug #513: union all changes char(3) column definition - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [BUGS] Bug #513: union all changes char(3) column definition
Date
Msg-id 200111220310.fAM3A2V08766@candle.pha.pa.us
Whole thread Raw
In response to Re: [BUGS] Bug #513: union all changes char(3) column definition  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] Bug #513: union all changes char(3) column definition
List pgsql-hackers
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Tom Lane writes:
> >> CREATE TABLE AS cannot be expected to be able to extract a suitable
> >> typmod from complex expressions.
> 
> > I don't think that would be entirely unreasonable.
> 
> Well, it might not be completely impossible, but I think it's well on
> the far side of unreasonable.  For *every operator* that produces a
> result of any of the typmod-using types, we'd have to maintain an
> auxiliary bit of code that can predict the result typmod.  That's
> a lot of code, and when you start considering user-defined functions
> it gets worse.  And all for what?  Not to do anything useful, but only
> to *eliminate* functionality.  Perhaps char without typmod is
> unnecessary (since it reduces to text), but numeric without typmod seems
> highly useful to me.
> 
> Strikes me as a very large amount of work to go in the wrong
> direction...

Added to TODO:
* CREATE TABLE AS can not determine column lengths from expressions


Seems it should be documented.  Do we throw an error in these cases?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Diff/Patch integration -> SQL cvs clone
Next
From: "Marc G. Fournier"
Date:
Subject: Re: beta3