In article <[EMAIL PROTECTED]>,
Richard Huxton <[EMAIL PROTECTED]> writes:

> Kathy Lo wrote:
>> On 11/21/07, Richard Huxton <[EMAIL PROTECTED]> wrote:

>>> You probably shouldn't attach any meaning to the numbers from a sequence
>>> - they're just guaranteed to be unique, nothing else.

> What you say here contradicts the following.

>> Actually, the sequence is formed by 4-digit of year and 6-digit of
>> sequence.

> So you *are* attaching significance to the number (by adding the
> current year to the front of it).

> Don't block users - have multiple sequences. If you define
> my_seq_2007, my_seq_2008, my_seq_2009 etc and then wrap access to them
> in a function you can EXTRACT() the year from the CURRENT_DATE and use
> that to form your per-year unique value.

Since sequences don't guarantee consecutivity anyway, why not just use
one sequence and prepend the year, e.g. by a view?


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to