Sample Header Ad - 728x90

Postgres strange conversion of the string 'now' to timestamp

4 votes
1 answer
322 views
It looks like postgres treats the string 'now()' the same as a call to the now() function. Why does postgres allow this?
select 'now'::timestamp;
or this?
select 'now()'::timestamp;
or even this?
select '  (  (  ))) now)('::timestamp;
It does not give this "a string is the same as a function" treatment to other functions such as clock_timestamp(). [DB fiddle](https://www.db-fiddle.com/f/4jyoMCicNSZpjMt4jFYoz5/11195)
Asked by Christian Long (143 rep)
Dec 6, 2023, 10:39 PM
Last activity: Dec 9, 2023, 08:41 PM