pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
changes sequences to unique
7+ messages / 6 participants
[nested] [flat]

* changes sequences to unique
@ 2001-06-06 18:16  Dave Stokes <dave@greatgeek.com>
  0 siblings, 5 replies; 7+ messages in thread

From: Dave Stokes @ 2001-06-06 18:16 UTC (permalink / raw)
  To: pgsql-admin; +Cc: dave@greatgeek.com

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
dave@greatgeek.com
817 329 9317




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changes sequences to unique
@ 2001-06-06 18:45  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Dave Stokes <dave@greatgeek.com>
  4 siblings, 0 replies; 7+ messages in thread

From: Stephan Szabo @ 2001-06-06 18:45 UTC (permalink / raw)
  To: Dave Stokes <dave@greatgeek.com>; +Cc: pgsql-admin

On Wed, 6 Jun 2001, Dave Stokes wrote:

> 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?





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changes sequences to unique
@ 2001-06-06 18:50  Thalis A. Kalfigopoulos <thalis@cs.pitt.edu>
  parent: Dave Stokes <dave@greatgeek.com>
  4 siblings, 0 replies; 7+ messages in thread

From: Thalis A. Kalfigopoulos @ 2001-06-06 18:50 UTC (permalink / raw)
  To: Dave Stokes <dave@greatgeek.com>; +Cc: pgsql-admin

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


On Wed, 6 Jun 2001, Dave Stokes wrote:

> 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
> dave@greatgeek.com
> 817 329 9317
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changes sequences to unique
@ 2001-06-06 18:57  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Dave Stokes <dave@greatgeek.com>
  4 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2001-06-06 18:57 UTC (permalink / raw)
  To: Dave Stokes <dave@greatgeek.com>; +Cc: pgsql-admin

Dave Stokes <dave@greatgeek.com> writes:
> 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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changes sequences to unique
@ 2001-06-06 19:30  Rene Pijlman <reageer.in.de.nieuwsgroep@onzin-adres.nl>
  parent: Dave Stokes <dave@greatgeek.com>
  4 siblings, 0 replies; 7+ messages in thread

From: Rene Pijlman @ 2001-06-06 19:30 UTC (permalink / raw)
  To: pgsql-admin

dave@greatgeek.com (Dave Stokes) schreef:
>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-createsequence.html

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
- ...

>Should I reload after adding unique to the sequence?  

I'm not sure what you mean by that.

-- 
Vriendelijke groet,
René Pijlman <rpijlman@spamcop.net>

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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changes sequences to unique
@ 2001-06-06 20:09  Stefan Huber <schweinsaug@crosswinds.net>
  parent: Dave Stokes <dave@greatgeek.com>
  4 siblings, 1 reply; 7+ messages in thread

From: Stefan Huber @ 2001-06-06 20:09 UTC (permalink / raw)
  To: pgsql-admin


>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!




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: changes sequences to unique
@ 2001-06-06 21:10  Rene Pijlman <reageer.in.de.nieuwsgroep@onzin-adres.nl>
  parent: Stefan Huber <schweinsaug@crosswinds.net>
  0 siblings, 0 replies; 7+ messages in thread

From: Rene Pijlman @ 2001-06-06 21:10 UTC (permalink / raw)
  To: pgsql-admin

schweinsaug@crosswinds.net (Stefan Huber) schreef:
>>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,
René Pijlman <rpijlman@spamcop.net>

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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2001-06-06 21:10 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-06 18:16 changes sequences to unique Dave Stokes <dave@greatgeek.com>
2001-06-06 18:45 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-06-06 18:50 ` Thalis A. Kalfigopoulos <thalis@cs.pitt.edu>
2001-06-06 18:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-06-06 19:30 ` Rene Pijlman <reageer.in.de.nieuwsgroep@onzin-adres.nl>
2001-06-06 20:09 ` Stefan Huber <schweinsaug@crosswinds.net>
2001-06-06 21:10   ` Rene Pijlman <reageer.in.de.nieuwsgroep@onzin-adres.nl>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox