From przemyslaw.slupkowski@euro.coig.pl Thu Sep 25 06:37:02 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C2D5BD1B561 for ; Thu, 25 Sep 2003 06:37:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 67892-06 for ; Thu, 25 Sep 2003 03:36:32 -0300 (ADT) Received: from coig.katowice.pl (pluton.coig.katowice.pl [217.98.68.8]) by svr1.postgresql.org (Postfix) with ESMTP id E8C94D1B54D for ; Thu, 25 Sep 2003 03:36:29 -0300 (ADT) Received: from [217.98.68.20] (HELO Mariuszb) by coig.katowice.pl (CommuniGate Pro SMTP 3.5.9) with SMTP id 135592 for pgsql-sql@postgresql.org; Thu, 25 Sep 2003 08:36:24 +0200 Message-ID: <005601c3832f$61fbcf60$930f10ac@win.coig.com> From: =?iso-8859-2?Q?Przemys=B3aw_S=B3upkowski?= To: "Lista dyskusyjna pgsql-sql" Subject: Sequenties in pgSQL 7.3.x Date: Thu, 25 Sep 2003 08:36:42 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0053_01C38340.257FE470" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.5 tagged_above=0.0 required=5.0 tests=HTML_30_40, RCVD_IN_OSIRUSOFT_COM X-Spam-Level: * X-Archive-Number: 200309/297 X-Sequence-Number: 15275 This is a multi-part message in MIME format. ------=_NextPart_000_0053_01C38340.257FE470 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Hi I am using postgresql 7.3.x. I am upgrating a database PostgreSQL.=20 The main problem is how to change field last value in sequencde which exist= s in database. I created script to read this field and then I'm drop the table, do modific= ation 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 ------=_NextPart_000_0053_01C38340.257FE470 Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable
Hi
I am using postgresql 7.3.x. I am upgrating a=20 database PostgreSQL.
The main problem is how to change field last value in sequencde which= =20 exists in database.
I created script to read this field and then I'm drop the table, = do=20 modification and i'm must change this value to another value.
But DBMS returns me message like that
ERROR:  You can't change sequence r= elation=20 seq_id_seq
How to do this
------=_NextPart_000_0053_01C38340.257FE470-- From jasiek@klaster.net Thu Sep 25 07:24:34 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6DF57D1B57B for ; Thu, 25 Sep 2003 07:24:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 70219-08 for ; Thu, 25 Sep 2003 04:24:25 -0300 (ADT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by svr1.postgresql.org (Postfix) with ESMTP id 5CA2FD1B55D for ; Thu, 25 Sep 2003 04:24:23 -0300 (ADT) Received: from klaster.net (core-1.citynet.pl [80.48.135.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id EE19B2B3D1; Thu, 25 Sep 2003 09:24:10 +0200 (CEST) Message-ID: <3F729819.3010108@klaster.net> Date: Thu, 25 Sep 2003 09:24:09 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.5a) Gecko/20030718 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: =?ISO-8859-2?Q?Przemys=B3aw_S=B3upkowski?= Cc: Lista dyskusyjna pgsql-sql Subject: Re: Sequenties in pgSQL 7.3.x References: <005601c3832f$61fbcf60$930f10ac@win.coig.com> In-Reply-To: <005601c3832f$61fbcf60$930f10ac@win.coig.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/298 X-Sequence-Number: 15276 > 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 From olly@lfix.co.uk Thu Sep 25 07:45:10 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E9166D1B897 for ; Thu, 25 Sep 2003 07:45:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 73926-10 for ; Thu, 25 Sep 2003 04:44:41 -0300 (ADT) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by svr1.postgresql.org (Postfix) with ESMTP id 2C99AD1B561 for ; Thu, 25 Sep 2003 04:44:39 -0300 (ADT) Received: from lfix.demon.co.uk ([80.177.205.209] helo=cerberus.lfix.co.uk) by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) id 1A2Qno-000I04-0U; Thu, 25 Sep 2003 08:44:40 +0100 Received: from linda.lfix.co.uk ([192.168.1.1]) by cerberus.lfix.co.uk with esmtp (Exim 4.22) id 1A2Qnb-0005jw-FL; Thu, 25 Sep 2003 08:44:27 +0100 Subject: Re: Sequenties in pgSQL 7.3.x From: Oliver Elphick To: =?iso-8859-2?Q?Przemys=B3aw_S=B3upkowski?= Cc: Lista dyskusyjna pgsql-sql In-Reply-To: <005601c3832f$61fbcf60$930f10ac@win.coig.com> References: <005601c3832f$61fbcf60$930f10ac@win.coig.com> Content-Type: text/plain; charset=iso-8859-2 Organization: LFIX Limited Message-Id: <1064475904.6609.385.camel@linda.lfix.co.uk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Thu, 25 Sep 2003 08:45:04 +0100 Content-Transfer-Encoding: quoted-printable X-LFIX-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/299 X-Sequence-Number: 15277 On Thu, 2003-09-25 at 07:36, Przemys=B3aw S=B3upkowski wrote: > Hi > I am using postgresql 7.3.x. I am upgrating a database PostgreSQL.=20 > 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? --=20 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D "Who shall separate us from the love of Christ? shall=20 tribulation, or distress, or persecution, or famine,=20 or nakedness, or peril, or sword?...But in all these=20 things we overwhelmingly conquer through Him who loved us." Romans 8:35,37=20 From dev@archonet.com Thu Sep 25 07:56:29 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1AAB5D1B57F for ; Thu, 25 Sep 2003 07:56:29 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 76327-02 for ; Thu, 25 Sep 2003 04:55:58 -0300 (ADT) Received: from anchor-post-37.mail.demon.net (anchor-post-37.mail.demon.net [194.217.242.87]) by svr1.postgresql.org (Postfix) with ESMTP id 116B8D1B500 for ; Thu, 25 Sep 2003 04:55:57 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-37.mail.demon.net with esmtp (Exim 3.35 #1) id 1A2Qyk-000BPS-0b; Thu, 25 Sep 2003 08:55:58 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 7BC6F1596E; Thu, 25 Sep 2003 08:55:57 +0100 (BST) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id D131C1592D; Thu, 25 Sep 2003 08:55:55 +0100 (BST) From: Richard Huxton To: =?iso-8859-2?q?Przemys=B3aw=20S=B3upkowski?= , "Lista dyskusyjna pgsql-sql" Subject: Re: Sequenties in pgSQL 7.3.x Date: Thu, 25 Sep 2003 08:55:54 +0100 User-Agent: KMail/1.5 References: <005601c3832f$61fbcf60$930f10ac@win.coig.com> In-Reply-To: <005601c3832f$61fbcf60$930f10ac@win.coig.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200309250855.54588.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/300 X-Sequence-Number: 15278 On Thursday 25 September 2003 07:36, Przemys=B3aw S=B3upkowski 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 valu= e. > 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 setva= l()=20 function instead. SELECT setval('my_seq', 1234); --=20 Richard Huxton Archonet Ltd From przemyslaw.slupkowski@euro.coig.pl Thu Sep 25 08:17:56 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8E20DD1B4EE for ; Thu, 25 Sep 2003 08:17:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 77505-06 for ; Thu, 25 Sep 2003 05:17:47 -0300 (ADT) Received: from coig.katowice.pl (pluton.coig.katowice.pl [217.98.68.8]) by svr1.postgresql.org (Postfix) with ESMTP id EB752D1B56B for ; Thu, 25 Sep 2003 05:17:44 -0300 (ADT) Received: from [217.98.68.20] (HELO Mariuszb) by coig.katowice.pl (CommuniGate Pro SMTP 3.5.9) with SMTP id 135955; Thu, 25 Sep 2003 10:17:44 +0200 Message-ID: <000501c3833d$63383ea0$930f10ac@win.coig.com> From: =?iso-8859-2?Q?Przemys=B3aw_S=B3upkowski?= To: "Lista dyskusyjna pgsql-sql" , "Richard Huxton" References: <005601c3832f$61fbcf60$930f10ac@win.coig.com> <200309250855.54588.dev@archonet.com> Subject: Re: Sequenties in pgSQL 7.3.x Date: Thu, 25 Sep 2003 10:16:57 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/301 X-Sequence-Number: 15279 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" To: "Przemysław Słupkowski" ; "Lista dyskusyjna pgsql-sql" 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