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
* pgsql-general@postgresql.org
> <mailto:pgsql-general@postgresql.org>
> *Sent:* Saturday, January 15, 2011 9:32 PM
> *Subject:* Re: [GENERAL] How to generate unique invoice numbers
> foreach day
>
> Why would you do that?
>
> You can alw
-general@postgresql.org
Sent: Saturday, January 15, 2011 9:32 PM
Subject: Re: [GENERAL] How to generate unique invoice numbers foreach day
Why would you do that?
You can always reset the sequence at the end of the day.
--
Jorge Godoy
On Sat, Jan 15, 2011 at 17:09, Andrus
gt; *Sent:* Saturday, January 15, 2011 8:41 PM
> *Subject:* ***SPAM*** Re: [GENERAL] How to generate unique
> invoice numbers foreach day
>
> Use a sequence.
>
> --
> Jorge Godoy mailto:jgo...@gmail.com>>
>
>
>
gt;
> Andrus.
>
> - Original Message -
> *From:* Jorge Godoy
> *To:* Andrus Moor
> *Cc:* pgsql-general@postgresql.org
> *Sent:* Saturday, January 15, 2011 8:41 PM
> *Subject:* ***SPAM*** Re: [GENERAL] How to generate unique invoice numbers
> foreach day
&
*** Re: [GENERAL] How to generate unique invoice numbers
foreach day
Use a sequence.
--
Jorge Godoy
2011/1/15 Andrus Moor
Invoice numbers have format yymmddn
where n is sequence number in day staring at 1 for every day.
command
SELECT COALESCE(MAX(nullif