Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C07B5475AFF for ; Wed, 4 Dec 2002 10:57:34 -0500 (EST) Received: from rh72.home.ee (adsl1030.estpak.ee [213.168.29.11]) by postgresql.org (Postfix) with ESMTP id 6F48C475FB0 for ; Wed, 4 Dec 2002 10:57:32 -0500 (EST) Received: from rh72.home.ee (localhost.localdomain [127.0.0.1]) by rh72.home.ee (8.12.5/8.12.5) with ESMTP id gB4FvTEe003377; Wed, 4 Dec 2002 20:57:29 +0500 Received: (from hannu@localhost) by rh72.home.ee (8.12.5/8.12.5/Submit) id gB4FvRPU003375; Wed, 4 Dec 2002 20:57:27 +0500 X-Authentication-Warning: rh72.home.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: [ADMIN] how to alter sequence. From: Hannu Krosing To: shridhar_daithankar@persistent.co.in Cc: "pgsql-hackers@postgresql.org" In-Reply-To: <3DEE71D4.21116.1940487@localhost> References: <1039010812.11433.75.camel@linda.lfix.co.uk> <3DEE71D4.21116.1940487@localhost> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039017445.2281.22.camel@rh72.home.ee> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 04 Dec 2002 20:57:26 +0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/240 X-Sequence-Number: 32695 Shridhar Daithankar kirjutas K, 04.12.2002 kell 20:51: > On 4 Dec 2002 at 20:41, Hannu Krosing wrote: > > hannu=# update seq set max_value = 99; > > ERROR: You can't change sequence relation seq > > hannu=# update pg_class set relkind = 'r' where relname = 'seq'; > > UPDATE 1 > > hannu=# update seq set max_value = 99; > > UPDATE 1 > > hannu=# update pg_class set relkind = 'S' where relname = 'seq'; > > UPDATE 1 > > hannu=# select * from seq; > > sequence_name | last_value | increment_by | max_value | min_value | > > cache_value | log_cnt | is_cycled | is_called > > ---------------+------------+--------------+-----------+-----------+-------------+---------+-----------+----------- > > seq | 1 | 1 | 99 | 1 > > | 1 | 1 | f | f I just discovered that changing these numbers does not change how the sequence behaves ;( Even after restarting the backend! Sorry! > That makes me wonder. If sequense is treated like a single column single row > table and it's value is guarenteed to be increasing even in case of aborted > transaction, is it correct to say that postgresql already has nested > transactions, albeit dormant? No. Sequences live outside of transactions. I have no idea why there is also a ingle column single row table created. The output of \d command is also weird, for all sequences I get: hannu=# \d seq Sequence "public.seq" Column | Type ---------------+--------- sequence_name | name last_value | bigint increment_by | bigint max_value | bigint min_value | bigint cache_value | bigint log_cnt | bigint is_cycled | boolean is_called | boolean with only the Sequence name changing ... --------------- Hannu