[rt-users] Changes to system

Vivek Khera khera at kcilink.com
Mon Dec 9 12:44:57 EST 2002


>>>>> "RL" == Rich Lafferty <rich+rt at lafferty.ca> writes:

RL> On Mon, Dec 09, 2002 at 10:43:07AM -0500, Rich Lafferty <rich+rt at lafferty.ca> wrote:
>> 
>> BEGIN WORK; 
>> ALTER TABLE Tickets id int not null;  -- removed "auto_increment"
>> INSERT INTO TICKETS (id) VALUES (new_starting_id);
>> ALTER TABLE Tickets id int not null auto_increment;
>> DELETE FROM TICKETS WHERE id = new_starting_id;
>> COMMIT;

If you supply a default, it will use it.  The next auto_increment
should pick up after the current max (dunno about these new fancy
table types, though).  At least the MyISAM file type returns the next
up from the max current value for auto_increment types.

RL> If someone would like to provide the equivalent instructions for
RL> PostgreSQL, I'll happily add them.

You just set the next val in the sequence.  This should do it:

SELECT setval('tickets_id_seq',42,false);

to make the next ticket number be 42.

You can even alter the sequence to give numbers incremented by values
other than 1, but that's not too exciting.



More information about the rt-users mailing list