DEFAULT fixed

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: DEFAULT fixed
Date: 1999-05-22 04:09:01
Message-ID: 199905220409.AAA23541@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have fixed the problem with DEFAULT ''.

test=> create table t1 (str1 char(2) default '',str2 text default
'',str3 text default '' );
CREATE
test=> insert into t1 values ('aa', 'string2', 'string3');
INSERT 18830 1
test=> insert into t1 (str3) values ('string3');
INSERT 18831 1
test=> select * from t1;
str1|str2 |str3
----+-------+-------
aa |string2|string3
| |string3
(2 rows)

The fix is to pass atttypmod into parse_coerce(), and when a bpchar type
is the output type, we pass the atttypmod value into bpcharin, so the
type is properly padded.

The bad news is that many other calls to parse_coerce do not have access
to the column's atttypmod value, so they don't properly pad the
coersion.

Does anyone have an opinion on this? Why does only DEFAULT have this
problem? Does anyone know how inserts of '' into char() fields get
padded with the proper atttypmod value? Do I need to pass atttypmod to
all the functions that call parse_coerce, so I can pass a value for all
cases?

--
Bruce Momjian | http://www.op.net/~candle
maillist(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

Attachment Content-Type Size
unknown_filename text/plain 8.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-05-22 04:10:32 DEFAULT '' fixed
Previous Message Bruce Momjian 1999-05-22 03:22:27 Re: [HACKERS] ddd and postgres prompt