0

I'm converting oracle to postgresql using AWS SCT tool.

I found the following line in one of function:

select (CLOCK_TIMESTAMP() AT TIME ZONE COALESCE(CURRENT_SETTING('aws_oracle_ext.tz', TRUE), 'UTC'))::TIMESTAMP(0)

Is there any other alternative of this setting aws_oracle_ext.tz in postgresql? I just want to remove dependency of all the extension of aws aws_oracle_ext.

Can I use the following one?

select (CLOCK_TIMESTAMP() AT TIME ZONE COALESCE(CURRENT_SETTING(now()::text, TRUE), 'UTC'))::TIMESTAMP(0)

MAK
  • 6,824
  • 25
  • 74
  • 131

1 Answers1

1

That looks silly (besides, it is not Oracle code).

  • If you want the wall clock time in your session time zone, use

    SELECT clock_timestamp()::timestamp
    
  • If you want the transaction timestamp, use

    SELECT localtimestamp
    
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263