'Netezza, how to RAISE NOTICE with current time

Im trying to debug Netezza procedure using RAISE NOTICE after UPDATE AND INSERT queries. Im trying to show the current time after each query is finished. I tried something like this:

RAISE NOTICE 'UPDATE time=%', now();

But that doesn't work. Only way I have had it working is to define a timestamp variable at the beginning of procedure and then just before raising notice I define this variablie like this:

timevar:=now();
RAISE NOTICE 'UPDATE time=%', timevar;

Is there a way where I can combine it just in one line and not have to define a new variable at beginning of procedure and assining it now() each time I whant to RAISE NOTICE ?



Solution 1:[1]

When you want to track progress through several steps in the same transaction, you can't use now() as that won't change.

It's a feature of transaction management within Postgres, that all statements within the same transaction get the same value for now()

However timeofday() DOES change, so you can use that.

And you can use a function in the place of identifier:

RAISE NOTICE 'UPDATE time=%', timeofday();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1