Re: Best data type to use for sales tax percent - Mailing list pgsql-general

From Jasen Betts
Subject Re: Best data type to use for sales tax percent
Date
Msg-id hapnud$unr$3@reversiblemaps.ath.cx
Whole thread Raw
In response to Best data type to use for sales tax percent  (Mike Christensen <mike@kitchenpc.com>)
Responses Re: Best data type to use for sales tax percent
Re: Best data type to use for sales tax percent
List pgsql-general
On 2009-10-09, Peter Eisentraut <peter_e@gmx.net> wrote:
> On Fri, 2009-10-09 at 11:46 -0700, Christophe Pettus wrote:
>> Domains are basically type aliases with an optional CHECK clause, so
>> you could do something like:
>>
>>     CREATE DOMAN sales_tax_rate AS DECIMAL(5,5) CHECK (VALUE >= 0);
>>
>> Then, you can use the type "sales_tax_rate" in your tables, etc. just
>> as a normal first-class type.  (The only limitation, right now, is
>> that you can't create an array of them.)
>
> Actually I wouldn't bother with the precision and scale at all.  I'd go
> with something like
>
> CREATE DOMAN sales_tax_rate AS DECIMAL CHECK (VALUE >= 0 AND VALUE <=1);

why the latter check ( VALUE <=1 )?

pgsql-general by date:

Previous
From: Jasen Betts
Date:
Subject: Re: Best data type to use for sales tax percent
Next
From: Jasen Betts
Date:
Subject: Re: bulk inserts