From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>, stiening(at)cannon(dot)astro(dot)umass(dot)edu, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Bug #513: union all changes char(3) column definition |
Date: | 2001-11-22 03:51:04 |
Message-ID: | 27975.1006401064@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> 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?
No. What we do right now is to generate non-length-constrained column
types for the created table.
Your TODO item is too pessimistic: we *do* determine the column length
in simple cases. For example:
regression=# create table foo (f1 char(3));
CREATE
regression=# create table bar as select * from foo;
SELECT
regression=# \d bar
Table "bar"
Column | Type | Modifiers
--------+--------------+-----------
f1 | character(3) |
However, in more complex cases we don't know the column length:
regression=# create table baz as select f1 || 'z' as f1 from foo;
SELECT
regression=# \d baz
Table "baz"
Column | Type | Modifiers
--------+--------+-----------
f1 | bpchar |
The argument here is about how much intelligence it's reasonable to
expect the system to have. It's very clearly not feasible to derive
a length limit automagically in every case. How hard should we try?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-11-22 03:53:27 | Re: Bug #513: union all changes char(3) column definition |
Previous Message | Bruce Momjian | 2001-11-22 03:10:02 | Re: Bug #513: union all changes char(3) column definition |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-11-22 03:53:27 | Re: Bug #513: union all changes char(3) column definition |
Previous Message | Bruce Momjian | 2001-11-22 03:50:44 | Re: beta3 |