pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Sequenties in pgSQL 7.3.x
5+ messages / 4 participants
[nested] [flat]

* Sequenties in pgSQL 7.3.x
@ 2003-09-25 06:36 Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>
  2003-09-25 07:24 ` Re: Sequenties in pgSQL 7.3.x Tomasz Myrta <jasiek@klaster.net>
  2003-09-25 07:45 ` Re: Sequenties in pgSQL 7.3.x Oliver Elphick <olly@lfix.co.uk>
  2003-09-25 07:55 ` Re: Sequenties in pgSQL 7.3.x Richard Huxton <dev@archonet.com>
  0 siblings, 3 replies; 5+ messages in thread

From: Przemysław Słupkowski @ 2003-09-25 06:36 UTC (permalink / raw)
  To: pgsql-sql

Hi
I am using postgresql 7.3.x. I am upgrating a database PostgreSQL. 
The main problem is how to change field last value in sequencde which exists in database.
I created script to read this field and then I'm drop the table, do modification and i'm must change this value to another value.
But DBMS returns me message like that
ERROR:  You can't change sequence relation seq_id_seq
How to do this

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

* Re: Sequenties in pgSQL 7.3.x
  2003-09-25 06:36 Sequenties in pgSQL 7.3.x Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>
@ 2003-09-25 07:24 ` Tomasz Myrta <jasiek@klaster.net>
  2 siblings, 0 replies; 5+ messages in thread

From: Tomasz Myrta @ 2003-09-25 07:24 UTC (permalink / raw)
  To: Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>; +Cc: pgsql-sql

> Hi
> I am using postgresql 7.3.x. I am upgrating a database PostgreSQL.
> The main problem is how to change field last value in sequencde which 
> exists in database.
> I created script to read this field and then I'm drop the table, do 
> modification and i'm must change this value to another value.
> But DBMS returns me message like that
> ERROR:  You can't change sequence relation seq_id_seq
> How to do this

Documentation says:
6.11. Sequence-Manipulation Functions
select setval('some_sequence',333);


Regards,
Tomasz Myrta




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

* Re: Sequenties in pgSQL 7.3.x
  2003-09-25 06:36 Sequenties in pgSQL 7.3.x Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>
@ 2003-09-25 07:45 ` Oliver Elphick <olly@lfix.co.uk>
  2 siblings, 0 replies; 5+ messages in thread

From: Oliver Elphick @ 2003-09-25 07:45 UTC (permalink / raw)
  To: Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>; +Cc: pgsql-sql

On Thu, 2003-09-25 at 07:36, Przemysław Słupkowski wrote:
> Hi
> I am using postgresql 7.3.x. I am upgrating a database PostgreSQL. 
> The main problem is how to change field last value in sequencde which
> exists in database.
> I created script to read this field and then I'm drop the table, do
> modification and i'm must change this value to another value.
> But DBMS returns me message like that
> ERROR:  You can't change sequence relation seq_id_seq
> How to do this

Use the setval() function?

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Who shall separate us from the love of Christ? shall 
      tribulation, or distress, or persecution, or famine, 
      or nakedness, or peril, or sword?...But in all these 
      things we overwhelmingly conquer through Him who loved
      us."               Romans 8:35,37 




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

* Re: Sequenties in pgSQL 7.3.x
  2003-09-25 06:36 Sequenties in pgSQL 7.3.x Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>
@ 2003-09-25 07:55 ` Richard Huxton <dev@archonet.com>
  2003-09-25 08:16   ` Re: Sequenties in pgSQL 7.3.x Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>
  2 siblings, 1 reply; 5+ messages in thread

From: Richard Huxton @ 2003-09-25 07:55 UTC (permalink / raw)
  To: Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>; pgsql-sql

On Thursday 25 September 2003 07:36, Przemysław Słupkowski wrote:
> Hi
> I am using postgresql 7.3.x. I am upgrating a database PostgreSQL.
> The main problem is how to change field last value in sequencde which
> exists in database. I created script to read this field and then I'm drop
> the table, do modification and i'm must change this value to another value.
> But DBMS returns me message like that
> ERROR:  You can't change sequence relation seq_id_seq
> How to do this

Are you using and UPDATE to set last_value? If so, you should use the setval() 
function instead.

SELECT setval('my_seq', 1234);

-- 
  Richard Huxton
  Archonet Ltd



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

* Re: Sequenties in pgSQL 7.3.x
  2003-09-25 06:36 Sequenties in pgSQL 7.3.x Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>
  2003-09-25 07:55 ` Re: Sequenties in pgSQL 7.3.x Richard Huxton <dev@archonet.com>
@ 2003-09-25 08:16   ` Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>
  0 siblings, 0 replies; 5+ messages in thread

From: Przemysław Słupkowski @ 2003-09-25 08:16 UTC (permalink / raw)
  To: pgsql-sql; Richard Huxton <dev@archonet.com>

HI
Thanks for help I'm found this solution and this works, but I'm use
something like that
PERFORM setval(seq_name, value);
It looks better but thanks a lot

----- Original Message -----
From: "Richard Huxton" <dev@archonet.com>
To: "Przemysław Słupkowski" <przemyslaw.slupkowski@euro.coig.pl>; "Lista
dyskusyjna pgsql-sql" <pgsql-sql@postgresql.org>
Sent: Thursday, September 25, 2003 9:55 AM
Subject: Re: [SQL] Sequenties in pgSQL 7.3.x


On Thursday 25 September 2003 07:36, Przemysław Słupkowski wrote:
> Hi
> I am using postgresql 7.3.x. I am upgrating a database PostgreSQL.
> The main problem is how to change field last value in sequencde which
> exists in database. I created script to read this field and then I'm drop
> the table, do modification and i'm must change this value to another
value.
> But DBMS returns me message like that
> ERROR:  You can't change sequence relation seq_id_seq
> How to do this

Are you using and UPDATE to set last_value? If so, you should use the
setval()
function instead.

SELECT setval('my_seq', 1234);

--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings




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


end of thread, other threads:[~2003-09-25 08:16 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-25 06:36 Sequenties in pgSQL 7.3.x Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>
2003-09-25 07:24 ` Tomasz Myrta <jasiek@klaster.net>
2003-09-25 07:45 ` Oliver Elphick <olly@lfix.co.uk>
2003-09-25 07:55 ` Richard Huxton <dev@archonet.com>
2003-09-25 08:16   ` Przemysław Słupkowski <przemyslaw.slupkowski@euro.coig.pl>

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