Re: [GENERAL] Difficulty modelling sales taxes

2017-01-02 Thread Vincent Veyron
On Mon, 2 Jan 2017 12:33:04 +0200 "Frank Millman" wrote: > > I want to model sales taxes in a flexible manner. I need one table to define > tax categories (e.g. VAT) and a subsidiary table to define tax codes within > each category (e.g. Standard Rate). > > CREATE TABLE

Re: [GENERAL] Difficulty modelling sales taxes

2017-01-02 Thread Adrian Klaver
On 01/02/2017 08:02 AM, Melvin Davidson wrote: *First, there is no need to make row_id's when you already have a valid primary key. In a perfect world yes, but this is a world with ORM's as I found out the hard way:

Re: [GENERAL] Difficulty modelling sales taxes

2017-01-02 Thread David G. Johnston
On Mon, Jan 2, 2017 at 7:38 AM, Melvin Davidson wrote: > > > *Next, DO NOT begin object names with underscores.* > ​This is only a bit arbitrary (though I do subscribe to it)...naming custom data types or tables with underscores is likely to introduce problems since an

Re: [GENERAL] Difficulty modelling sales taxes

2017-01-02 Thread David G. Johnston
On Mon, Jan 2, 2017 at 3:33 AM, Frank Millman wrote: > > CONSTRAINT _prod_tax_code_2 FOREIGN KEY (category_id, tax_code) > REFERENCES tax_codes (category_id, code)); > ​This is ​typical solution to this modelling problem. If you need to do other stuff (introduce

Re: [GENERAL] Difficulty modelling sales taxes

2017-01-02 Thread Melvin Davidson
>> >> *From:* amul sul >> *Sent:* Monday, January 02, 2017 12:42 PM >> *To:* Frank Millman >> *Cc:* pgsql-general >> *Subject:* Re: [GENERAL] Difficulty modelling sales taxes >> >> > On Mon, Jan 2, 2017 at 4:03 PM, Fr

Re: [GENERAL] Difficulty modelling sales taxes

2017-01-02 Thread Adrian Klaver
Re: [GENERAL] Difficulty modelling sales taxes > On Mon, Jan 2, 2017 at 4:03 PM, Frank Millman <fr...@chagford.com <mailto:fr...@chagford.com>> wrote: > > Hi all > > > > It is a bit ugly, because I have to use the ‘NVARCHAR code’ colum

Re: [GENERAL] Difficulty modelling sales taxes

2017-01-02 Thread Melvin Davidson
On Mon, Jan 2, 2017 at 6:29 AM, Frank Millman <fr...@chagford.com> wrote: > > *From:* amul sul > *Sent:* Monday, January 02, 2017 12:42 PM > *To:* Frank Millman > *Cc:* pgsql-general > *Subject:* Re: [GENERAL] Difficulty modelling sales taxes > > > On Mon, Jan

Re: [GENERAL] Difficulty modelling sales taxes

2017-01-02 Thread Frank Millman
From: amul sul Sent: Monday, January 02, 2017 12:42 PM To: Frank Millman Cc: pgsql-general Subject: Re: [GENERAL] Difficulty modelling sales taxes > On Mon, Jan 2, 2017 at 4:03 PM, Frank Millman <fr...@chagford.com> wrote: > > Hi all > > > > It is a bit

Re: [GENERAL] Difficulty modelling sales taxes

2017-01-02 Thread amul sul
On Mon, Jan 2, 2017 at 4:03 PM, Frank Millman wrote: > Hi all > > It is a bit ugly, because I have to use the ‘NVARCHAR code’ column from > tax_codes, not the primary key, but I think it would work. > NVARCHAR ? Are you using PostgreSQL as database server? Regards, Amul --