[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem entering new VAT rates



Chris Travers schreef op 25-09-12 13:41:

You will probably want to also:

CREATE UNIQUE INDEX tax_chart_id_current_u ON tax(chart_id) WHERE
validto IS NULL;

That gives me:
ERROR: could not create unique index "tax_chart_id_current_u"
DETAIL: Key (chart_id)=(10153) is duplicated.

Which it is. In fact the column chart_id doesn't make much sense to me:

my-database=# select * from tax;
 chart_id | rate | taxnumber |  validto   | pass | taxmodule_id
----------+------+-----------+------------+------+--------------
    10155 | 0.19 |           | 2012-09-30 |    0 |            1
    10155 | 0.21 |           |            |    0 |            1
    10157 | 0.06 |           |            |    0 |            1
    10151 | 0.19 |           | 2012-09-30 |    0 |            1
    10153 | 0.21 |           |            |    0 |            1
    10153 | 0.06 |           |            |    0 |            1
(6 rows)

There are two high rates and one low rate, which is OK, and one each for buying and one for selling. However, the new high rate has the same chart_id (10153) as the old low rate.

Is this how it should be? Or should it be changed manually?

J.

--
www.ardispark.nl
tel. 06 5341 4670