pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Setting Next Value in Sequence
8+ messages / 4 participants
[nested] [flat]

* Setting Next Value in Sequence
@ 1999-03-16 12:37  Tim Perdue <perdue@raccoon.com>
  0 siblings, 3 replies; 8+ messages in thread

From: Tim Perdue @ 1999-03-16 12:37 UTC (permalink / raw)
  To: pgsql-sql@hub.org

Maybe it's due to sleep deprivation, but this is not working. I'm trying to
update a seqence to a higher number, and it won't let me.

db_domain=> update seq_mailid set last_value=1375000;
ERROR:  You can't change sequence relation seq_mailid

My sense of humor has totally faded over the last two days, and I would
appreciate sone input.

Tim




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

* Re: [SQL] Setting Next Value in Sequence
@ 1999-03-16 12:57  Remigiusz Sokolowski <rems@gdansk.sprint.pl>
  parent: Tim Perdue <perdue@raccoon.com>
  2 siblings, 0 replies; 8+ messages in thread

From: Remigiusz Sokolowski @ 1999-03-16 12:57 UTC (permalink / raw)
  To: Tim Perdue <perdue@raccoon.com>; +Cc: pgsql-sql@hub.org

> Maybe it's due to sleep deprivation, but this is not working. I'm trying to
> update a seqence to a higher number, and it won't let me.
> 
> db_domain=> update seq_mailid set last_value=1375000;
> ERROR:  You can't change sequence relation seq_mailid
> 
> My sense of humor has totally faded over the last two days, and I would
> appreciate sone input.

So, may be just drop sequence and create new one with start 1375000.
	Rem

-------------------------------------------------------------------*------------
Remigiusz Sokolowski      e-mail: rems@gdansk.sprint.pl           * *		
-----------------------------------------------------------------*****----------




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

* Re: [SQL] Setting Next Value in Sequence
@ 1999-03-16 13:03  Herouth Maoz <herouth@oumail.openu.ac.il>
  parent: Tim Perdue <perdue@raccoon.com>
  2 siblings, 0 replies; 8+ messages in thread

From: Herouth Maoz @ 1999-03-16 13:03 UTC (permalink / raw)
  To: Tim Perdue <perdue@raccoon.com>; pgsql-sql@hub.org

At 14:37 +0200 on 16/3/99, Tim Perdue wrote:


> Maybe it's due to sleep deprivation, but this is not working. I'm trying to
> update a seqence to a higher number, and it won't let me.
>
> db_domain=> update seq_mailid set last_value=1375000;
> ERROR:  You can't change sequence relation seq_mailid
>
> My sense of humor has totally faded over the last two days, and I would
> appreciate sone input.

Do you (or the user who is trying to do this) own the sequence? Do you have
the right access rights to it?

In any case, I always thought the best is to drop the sequence and create
it with a proper start number.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





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

* Re: [SQL] Setting Next Value in Sequence
@ 1999-03-16 13:06  Tim Perdue <perdue@raccoon.com>
  0 siblings, 2 replies; 8+ messages in thread

From: Tim Perdue @ 1999-03-16 13:06 UTC (permalink / raw)
  To: Remigiusz Sokolowski <rems@gdansk.sprint.pl>; pgsql-sql@hub.org

May table is defined to use the sequence, and the table is not trivial to
export and rebuild with the new sequence.

There's got to be some way around this. I'm probably going to have to create
a bogus table using that sequence, then insert 150,000 bogus records to
increment the sequence. Then drop the table.

Tim


-----Original Message-----
From: Remigiusz Sokolowski <rems@gdansk.sprint.pl>
To: Tim Perdue <perdue@raccoon.com>
Cc: pgsql-sql@hub.org <pgsql-sql@hub.org>
Date: Tuesday, March 16, 1999 6:57 AM
Subject: Re: [SQL] Setting Next Value in Sequence


>> Maybe it's due to sleep deprivation, but this is not working. I'm trying
to
>> update a seqence to a higher number, and it won't let me.
>>
>> db_domain=> update seq_mailid set last_value=1375000;
>> ERROR:  You can't change sequence relation seq_mailid
>>
>> My sense of humor has totally faded over the last two days, and I would
>> appreciate sone input.
>
>So, may be just drop sequence and create new one with start 1375000.
> Rem
>
>-------------------------------------------------------------------*-------
-----
>Remigiusz Sokolowski      e-mail: rems@gdansk.sprint.pl           * *
>-----------------------------------------------------------------*****-----
-----




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

* Re: [SQL] Setting Next Value in Sequence
@ 1999-03-16 13:22  Patrik Kudo <kudo@partitur.se>
  parent: Tim Perdue <perdue@raccoon.com>
  2 siblings, 0 replies; 8+ messages in thread

From: Patrik Kudo @ 1999-03-16 13:22 UTC (permalink / raw)
  To: Tim Perdue <perdue@raccoon.com>; +Cc: pgsql-sql@hub.org

Hi,

You can't manipulate the sequence that way. You can do the following
though:

select setval('seq_mailid', 1375000);

Hope that helps.

Regards,
Patrik Kudo

Tim Perdue wrote:
> 
> Maybe it's due to sleep deprivation, but this is not working. I'm trying to
> update a seqence to a higher number, and it won't let me.
> 
> db_domain=> update seq_mailid set last_value=1375000;
> ERROR:  You can't change sequence relation seq_mailid
> 
> My sense of humor has totally faded over the last two days, and I would
> appreciate sone input.
> 
> Tim



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

* Re: [SQL] Setting Next Value in Sequence
@ 1999-03-16 13:23  Herouth Maoz <herouth@oumail.openu.ac.il>
  parent: Tim Perdue <perdue@raccoon.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Herouth Maoz @ 1999-03-16 13:23 UTC (permalink / raw)
  To: Tim Perdue <perdue@raccoon.com>; pgsql-sql@hub.org

At 15:06 +0200 on 16/3/99, Tim Perdue wrote:


> May table is defined to use the sequence, and the table is not trivial to
> export and rebuild with the new sequence.
>
> There's got to be some way around this. I'm probably going to have to create
> a bogus table using that sequence, then insert 150,000 bogus records to
> increment the sequence. Then drop the table.

What? You just need to drop and create a sequence with the same name. At
least it works for me (though I noticed that unprivileged users have
problems creating tables without having the sequences created first, which
IMHO is a bug. But I don't think it applies to already-created tables).

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





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

* Re: [SQL] Setting Next Value in Sequence
@ 1999-03-16 13:25  Remigiusz Sokolowski <rems@gdansk.sprint.pl>
  parent: Tim Perdue <perdue@raccoon.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Remigiusz Sokolowski @ 1999-03-16 13:25 UTC (permalink / raw)
  To: Tim Perdue <perdue@raccoon.com>; +Cc: pgsql-sql@hub.org

> 
> May table is defined to use the sequence, and the table is not trivial to
> export and rebuild with the new sequence.
> 
> There's got to be some way around this. I'm probably going to have to create
> a bogus table using that sequence, then insert 150,000 bogus records to
> increment the sequence. Then drop the table.
> 
> Tim
AFAIK if You don't use serial type You can just drop sequence and create
new with the same name. Of course You need increase start value of this
sequence to get right value at next insert.
I think there is no some secret conjunction between sequence and table
which use it, so if You replace Your sequence with new one of the same
name, there should be no problems.

CREATE SEQUENCE your_prev_seq START your_next_val_from_table;

Naturally if You use serial type - there may be some problems with such
work around.
	I don't understand, why You want to drop table - do You use serial
type?
	Rem
-------------------------------------------------------------------*------------
Remigiusz Sokolowski      e-mail: rems@gdansk.sprint.pl           * *		
-----------------------------------------------------------------*****----------




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

* Re: [SQL] Setting Next Value in Sequence
@ 1999-03-16 14:17  Tim Perdue <perdue@raccoon.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Tim Perdue @ 1999-03-16 14:17 UTC (permalink / raw)
  To: Patrik Kudo <kudo@partitur.se>; pgsql-sql@hub.org

That did the trick. Thanks.

Tim



-----Original Message-----
From: Patrik Kudo <kudo@partitur.se>
To: Tim Perdue <perdue@raccoon.com>
Cc: pgsql-sql@hub.org <pgsql-sql@hub.org>
Date: Tuesday, March 16, 1999 7:21 AM
Subject: Re: [SQL] Setting Next Value in Sequence


>Hi,
>
>You can't manipulate the sequence that way. You can do the following
>though:
>
>select setval('seq_mailid', 1375000);
>
>Hope that helps.
>
>Regards,
>Patrik Kudo
>
>Tim Perdue wrote:
>>
>> Maybe it's due to sleep deprivation, but this is not working. I'm trying
to
>> update a seqence to a higher number, and it won't let me.
>>
>> db_domain=> update seq_mailid set last_value=1375000;
>> ERROR:  You can't change sequence relation seq_mailid
>>
>> My sense of humor has totally faded over the last two days, and I would
>> appreciate sone input.
>>
>> Tim




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


end of thread, other threads:[~1999-03-16 14:17 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-03-16 12:37 Setting Next Value in Sequence Tim Perdue <perdue@raccoon.com>
1999-03-16 12:57 ` Remigiusz Sokolowski <rems@gdansk.sprint.pl>
1999-03-16 13:03 ` Herouth Maoz <herouth@oumail.openu.ac.il>
1999-03-16 13:22 ` Patrik Kudo <kudo@partitur.se>
1999-03-16 13:06 Re: [SQL] Setting Next Value in Sequence Tim Perdue <perdue@raccoon.com>
1999-03-16 13:23 ` Herouth Maoz <herouth@oumail.openu.ac.il>
1999-03-16 13:25 ` Remigiusz Sokolowski <rems@gdansk.sprint.pl>
1999-03-16 14:17 Re: [SQL] Setting Next Value in Sequence Tim Perdue <perdue@raccoon.com>

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