Sobre raise notice y variables

From: Tonny <tonny(dot)lists(at)gmail(dot)com>
To: ecpug(at)postgresql(dot)org
Subject: Sobre raise notice y variables
Date: 2013-07-01 17:04:05
Message-ID: 51D1B685.5080602@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: ecpug

Buenas, quiero mostrar la fecha hora actual en el que van sucediendo
eventos en mi funcion estoy usando
raise notice 'Inicia... % ', CURRENT_TIMESTAMP;
, pero al usar CURRENT_TIMESTAMP o SELECT now(), me da siempre la misma
hora y fecha de inicio.

Este es parte del código :

raise notice 'Inicia... % ', CURRENT_TIMESTAMP;
for v_fecha in select distinct fecha from only tabla where
extract(year from fecha) = 2013 AND extract( month from fecha) = 4 order
by 1 loop
raise notice 'Fecha % ----- % ', v_fecha, CURRENT_TIMESTAMP;
v_particion = 'history.tabla_' || lpad(extract(month from
v_fecha)::text, 2, '0') || '_' || extract(year from v_fecha);
execute 'insert into ' || v_particion || ' select * from only
tabla where fecha = ' || quote_literal(v_fecha)::text;
delete from only tabla where fecha = v_fecha;
end loop;
end

Y este el resultado:

NOTICE: Inicia... 2013-07-01 11:03:30.55945-05
NOTICE: Fecha 2013-04-01 ----- 2013-07-01 11:03:30.55945-05
NOTICE: Fecha 2013-04-02 ----- 2013-07-01 11:03:30.55945-05
NOTICE: Fecha 2013-04-03 ----- 2013-07-01 11:03:30.55945-05
NOTICE: Fecha 2013-04-04 ----- 2013-07-01 11:03:30.55945-05

No va imprimiendo la verdadera fecha y hora cuando sucede sino como que
se queda almacenada el valor inicial, y estas tareas que realizo en la
función tardan varios minutos en terminar.

Lo que necesito es q salga algo parecido a esto:

NOTICE: Inicia... 2013-07-01 07:03:30.55945-05
NOTICE: Fecha 2013-04-01 ----- 2013-07-01 07:44:08
NOTICE: Fecha 2013-04-02 ----- 2013-07-01 07:49:01
NOTICE: Fecha 2013-04-03 ----- 2013-07-01 07:55:15
NOTICE: Fecha 2013-04-04 ----- 2013-07-01 08:20:11

Gracias por sus comentarios

Responses

Browse ecpug by date

  From Date Subject
Next Message Jaime Casanova 2013-07-03 04:33:15 Re: Sobre raise notice y variables
Previous Message Martín Marqués 2013-06-23 18:03:20 Re: Migracion de MySQL a Postgres