Re: [HACKERS] Should cast to CHAR or NUMERIC enforce default length limit? - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] Should cast to CHAR or NUMERIC enforce default length limit?
Date
Msg-id 3885E548.69CE8FA1@alumni.caltech.edu
Whole thread Raw
In response to Should cast to CHAR or NUMERIC enforce default length limit?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Should cast to CHAR or NUMERIC enforce default length limit?
List pgsql-hackers
> I think this could be done by having gram.y insert -1 as the default
> typmod for a "char" or "numeric" Typename.  The rest of the system
> already interprets such a typmod as specifying no particular length
> constraint.  Then, to preserve the rule that
>         create table foo (bar char);
> creates a char(1) field, analyze.c would have to be responsible for
> inserting the appropriate default length in place of -1 when processing
> a column definition.

Sounds good. My first inclination was to work this out in gram.y,
which you could do pretty easily for TYPECAST rules, but perhaps it
would be better to isolate *all* of the default size settings to a
separate routine called from the appropriate place. Eventually, this
could even be a tunable parameter settable during the session (e.g.
"SET DEFAULT PRECISION NUMERIC ...").
                    - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Daily regression testing via vmware - useful?
Next
From: Sevo Stille
Date:
Subject: (no subject)