changes sequences to unique 
Author Message
 changes sequences to unique

I have a sequence that I 'thought' was providing unique numbers but is
not.  Is there someway to turn on unique-ness?  Should I reload after
adding unique to the sequence?  Any other thoughts on digging my way out
of the problem?

Thanks in advance!
--

Dave Stokes

817 329 9317

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command



Mon, 24 Nov 2003 02:36:24 GMT
 changes sequences to unique

Quote:

> I have a sequence that I 'thought' was providing unique numbers but is
> not.  Is there someway to turn on unique-ness?  Should I reload after
> adding unique to the sequence?  Any other thoughts on digging my way out
> of the problem?

They should provide unique numbers.  You could get non-unique values in
a column with a sequence default if you manually insert values (the
sequence wouldn't know about these).  Can you give a sequence of events
from a blank start to replicate what you're seeing?

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Mon, 24 Nov 2003 03:10:38 GMT
 changes sequences to unique

Quote:

> I have a sequence that I 'thought' was providing unique numbers but is
> not.  Is there someway to turn on unique-ness?

Huh?  nextval() should always produce unique values (unless the sequence
wraps around, of course).

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command



Mon, 24 Nov 2003 03:27:35 GMT
 changes sequences to unique

Quote:
>I have a sequence that I 'thought' was providing unique numbers but is
>not. Is there someway to turn on unique-ness?  

Sequences are documented on
http://www.postgresql.org/users-lounge/docs/7.1/reference/sql-creates...

The numbers may not be unique if:
- there are already values in the column that conflict with numbers
(to be) generated by the sequence
- it was created with "cycle" and it cycles
- values are inserted into the column that have not been generated by
the sequence
- there is more than one sequence inserting values into the column
- there is a trigger that interferes
- ...

Quote:
>Should I reload after adding unique to the sequence?  

I'm not sure what you mean by that.

--
Vriendelijke groet,

Wat wil jij leren?
http://www.leren.nl/



Mon, 24 Nov 2003 03:30:10 GMT
 changes sequences to unique
How did you conclude that it doesn't provide unique numbers? A sequence gives unique values by definition (unless you allow it to cycle and you actually wrapped around the 2.1billion boundary)

cheers,
thalis

Quote:

> I have a sequence that I 'thought' was providing unique numbers but is
> not.  Is there someway to turn on unique-ness?  Should I reload after
> adding unique to the sequence?  Any other thoughts on digging my way out
> of the problem?

> Thanks in advance!
> --

> Dave Stokes

> 817 329 9317

> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly


Mon, 24 Nov 2003 03:29:38 GMT
 changes sequences to unique

Quote:
>Huh?  nextval() should always produce unique values (unless the sequence
>wraps around, of course).

What about explicitly overruling a sequence by INSERTing a specific value,
when it is not a primary key or defined as serial, but a manual sequence?

Stefan

--
I don't find it hard to meet expenses. They're everywhere!

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Mon, 24 Nov 2003 04:13:25 GMT
 changes sequences to unique

Quote:
>>Huh?  nextval() should always produce unique values (unless the sequence
>>wraps around, of course).

>What about explicitly overruling a sequence by INSERTing a specific value,
>when it is not a primary key or defined as serial, but a manual sequence?

Then the sequence will still produce unique values. Its just the
database column that contains a duplicate :-)

--
Vriendelijke groet,

Wat wil jij leren?
http://www.leren.nl/



Mon, 24 Nov 2003 05:10:48 GMT
 
 [ 7 post ] 

 Relevant Pages 

1. need help for generating unique sequence numbers

2. unique sequence

3. Generating unique values without triggers/sequences

4. msql : unique, sequence

5. How can I get SQL Server to generate a unique Sequence Number

6. Concurrency Problem - Generating a unique Sequence number

7. SQL*Loader And Unique Sequence Numbers

8. Unique sequence generator with reclaim

9. How do I create a Unique field that generates its own sequence number

10. Generating a unique sequence

11. Auto-Generate unique Sequence Numbers?


 
Powered by phpBB® Forum Software