Re: [HACKERS] question about deparsing const node and its typmod

2009-04-02 Thread Kevin Grittner
Tom Lane wrote: > "Tao Ma" writes: >> Is it really important to show the 'bpchar' if there is no any >> explicit casting for the column default value. > > Yeah. We cannot say "char" because per SQL spec, that means > "char(1)", but there mustn't be a restriction to a single character > here.

Re: [HACKERS] question about deparsing const node and its typmod

2009-04-02 Thread Tom Lane
"Tao Ma" writes: > Is it really important to show the > 'bpchar' if there is no any explicit casting for the column default value. Yeah. We cannot say "char" because per SQL spec, that means "char(1)", but there mustn't be a restriction to a single character here. regression=# select 'abc'::cha

Re: [HACKERS] question about deparsing const node and its typmod

2009-04-01 Thread Tao Ma
Thank you for your reply to the question. If it was chosen to reproduce the actual semantics of the expression in various contexts, I think the bpchar type of 'abc'::bpchar is surprised me. Is it really important to show the 'bpchar' if there is no any explicit casting for the column default value.

Re: [HACKERS] question about deparsing const node and its typmod

2009-03-28 Thread Tom Lane
"Tao Ma" 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 > - > 'a

[HACKERS] question about deparsing const node and its typmod

2009-03-28 Thread Tao Ma
Hi, Recently, I am reading the postgres codes, and I have a question about the deparsing some expressions which is contains Const node. The following SQL will retrieve the definition stored by postgres database for table "t": CREATE TABLE "t" (c1 CHAR(5) DEFAULT 'abc', c2 CHAR(5