Re: Bug #513: union all changes char(3) column definition

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: 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:53:27
Message-ID: 200111220353.fAM3rRg12994@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

> 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?

I don't think we can try in this case, especially because our functions
are all burried down in adt/. However, I don't think creating a bpchar
with no length is a proper solution. Should we just punt to text in
these cases? Seems cleaner, perhaps even throw an elog(NOTICE)
mentioning the promotion to text.

--
Bruce Momjian | http://candle.pha.pa.us
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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-11-22 04:08:37 Re: Bug #513: union all changes char(3) column definition
Previous Message Tom Lane 2001-11-22 03:51:04 Re: Bug #513: union all changes char(3) column definition

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-11-22 04:08:37 Re: Bug #513: union all changes char(3) column definition
Previous Message Tom Lane 2001-11-22 03:51:04 Re: Bug #513: union all changes char(3) column definition