Skip to content

Commit

Permalink
Per Steve Singer's comments....
Browse files Browse the repository at this point in the history
- don't need ::timestamp to coerce now()
- Should only alter columns for *OUR* tables
  • Loading branch information
Christopher Browne committed Dec 16, 2010
1 parent 2387893 commit 044a0f5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/backend/slony1_funcs.sql
Expand Up @@ -5092,7 +5092,7 @@ BEGIN
if v_current_status = 0 then
perform "pg_catalog".setval('@NAMESPACE@.sl_log_status', 3);
perform @NAMESPACE@.registry_set_timestamp(
'logswitch.laststart', now()::timestamptz);
'logswitch.laststart', now());
raise notice 'Slony-I: Logswitch to sl_log_2 initiated';
return 2;
end if;
Expand All @@ -5104,7 +5104,7 @@ BEGIN
if v_current_status = 1 then
perform "pg_catalog".setval('@NAMESPACE@.sl_log_status', 2);
perform @NAMESPACE@.registry_set_timestamp(
'logswitch.laststart', now()::timestamptz);
'logswitch.laststart', now());
raise notice 'Slony-I: Logswitch to sl_log_1 initiated';
return 1;
end if;
Expand Down Expand Up @@ -5405,14 +5405,17 @@ begin

if exists (select 1 from information_schema.columns c
where table_schema = '_@CLUSTERNAME@' and data_type = 'timestamp without time zone'
and exists (select 1 from information_schema.tables t where t.table_schema = c.table_schema and t.table_name = c.table_name and t.table_type = 'BASE TABLE')) then
and exists (select 1 from information_schema.tables t where t.table_schema = c.table_schema and t.table_name = c.table_name and t.table_type = 'BASE TABLE')
and (c.table_name, c.column_name) in (('sl_confirm', 'con_timestamp'), ('sl_event', 'ev_timestamp'), ('sl_registry', 'reg_timestamp'),('sl_archive_counter', 'ac_timestamp')))
then

-- Preserve sl_status
select pg_get_viewdef('@NAMESPACE@.sl_status') into v_keepstatus;
execute 'drop view sl_status';
for v_tab_row in select table_schema, table_name, column_name from information_schema.columns c
where table_schema = '_@CLUSTERNAME@' and data_type = 'timestamp without time zone'
and exists (select 1 from information_schema.tables t where t.table_schema = c.table_schema and t.table_name = c.table_name and t.table_type = 'BASE TABLE')
and (table_name, column_name) in (('sl_confirm', 'con_timestamp'), ('sl_event', 'ev_timestamp'), ('sl_registry', 'reg_timestamp'),('sl_archive_counter', 'ac_timestamp'))
loop
raise notice 'Changing Slony-I column [%.%] to timestamp WITH time zone', v_tab_row.table_name, v_tab_row.column_name;
v_query := 'alter table ' || @NAMESPACE@.slon_quote_brute(v_tab_row.table_schema) ||
Expand Down

0 comments on commit 044a0f5

Please sign in to comment.