Re: alter column resize triggers question - Mailing list pgsql-admin
From | Bob Lunney |
---|---|
Subject | Re: alter column resize triggers question |
Date | |
Msg-id | 162237.94877.qm@web39706.mail.mud.yahoo.com Whole thread Raw |
In response to | alter column resize triggers question (Mike Broers <mbroers@gmail.com>) |
List | pgsql-admin |
Mike, Doesn't look like it, at least on 8.4. Give the script below a try for yourself. Another approach would be to create a new table with the schema you need, insert the rows from your existing table into it, rename the two tables appropriately, then recreate the indexes and trigger on the new table. That way you won't have to worry about the trigger firing at all. Bob Lunney ============== create table blah (blah int, ts timestamptz); create function update_timestamp() returns trigger as $$ begin new.ts = now(); return new; end; $$ language plpgsql; create trigger blah_t before insert or update on blah for each row execute procedure update_timestamp(); insert into blah values (1); insert into blah values (2); insert into blah values (3); select * from blah; blah | ts ------+------------------------------- 1 | 2010-06-21 14:33:32.14576-04 2 | 2010-06-21 14:33:34.545739-04 3 | 2010-06-21 14:33:36.097878-04 (3 rows) alter table blah alter column blah type bigint; select * from blah; blah | ts ------+------------------------------- 1 | 2010-06-21 14:33:32.14576-04 2 | 2010-06-21 14:33:34.545739-04 3 | 2010-06-21 14:33:36.097878-04 (3 rows) =============== --- On Mon, 6/21/10, Mike Broers <mbroers@gmail.com> wrote:
|
pgsql-admin by date: