Re: [ADMIN] how to alter sequence. - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: [ADMIN] how to alter sequence.
Date
Msg-id 1039017445.2281.22.camel@rh72.home.ee
Whole thread Raw
In response to Re: [ADMIN] how to alter sequence.  ("Shridhar Daithankar" <shridhar_daithankar@persistent.co.in>)
List pgsql-hackers
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 | namelast_value    | bigintincrement_by  | bigintmax_value     |
bigintmin_value    | bigintcache_value   | bigintlog_cnt       | bigintis_cycled     | booleanis_called     | boolean
 

with only the Sequence name changing ...

---------------
Hannu



pgsql-hackers by date:

Previous
From: "Shridhar Daithankar"
Date:
Subject: Re: [ADMIN] how to alter sequence.
Next
From: Rod Taylor
Date:
Subject: Re: [ADMIN] how to alter sequence.