Re: How to generate unique invoice numbers foreach day

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to generate unique invoice numbers foreach day
Date: 2011-01-15 20:38:44
Message-ID: alpine.LNX.2.00.1101151236430.32107@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 15 Jan 2011, Andrus Moor wrote:

> There are 365 days in year. Do you really think pre-creating sequence for
> every day for every year is best solution ?

Andrus,

I just saw this thread so my idea may not work for you. What I'd do is use
the Julian date (that is, the sequential day from 1-365/6) followed by 1, 2,
or 3 digits depending on how many invoices are generated each day. Makes
sorting and comparisons simple.

Rich

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jon Smark 2011-01-15 20:57:50 Re: Record with a field consisting of table rows
Previous Message Tomas Vondra 2011-01-15 20:32:53 Re: Need help writing exclusion constraint