Re: question about deparsing const node and its typmod
От | Tom Lane |
---|---|
Тема | Re: question about deparsing const node and its typmod |
Дата | |
Msg-id | 18655.1238258851@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | question about deparsing const node and its typmod ("Tao Ma" <feng_eden@163.com>) |
Список | pgsql-hackers |
"Tao Ma" <feng_eden@163.com> writes: > CREATE TABLE "t" (c1 CHAR(5) DEFAULT 'abc', > c2 CHAR(5) DEFAULT 'abc'::CHAR(5)); > SELECT pg_get_expr(adbin, adrelid) > FROM pg_attrdef > WHERE adrelid = (SELECT oid FROM pg_class WHERE relname = 't'); > pg_get_expr > --------------------- > 'abc'::bpchar > 'abc'::character(5) > (2 rows) > so I am courious about is there any possibility to make the default value > for c1 look like the default value for c2. That behavior is very carefully chosen to reproduce the actual semantics of the expression in various contexts. We can't change it just to make it "look prettier". If you check the CVS history of ruleutils.c to see when that logic got changed, you should be able to locate pgsql-hackers discussions that worked out what the behavior has to be. I seem to remember that the most recent iteration had to do with making sure that ALTER COLUMN TYPE had unsurprising side-effects on the column's default. regards, tom lane
В списке pgsql-hackers по дате отправления: