Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Current setting in postgresql

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Can I use the following one?

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

>Solution :

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
    
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading