Sample Header Ad - 728x90

Passing value of datatype interval in parametrized query

8 votes
2 answers
10899 views
The context is connecting to a Postgres db from a rest server. To consider a hypothetical representative example: I would like to be able to get a list of names where the account creation date is older/newer than an arbitrary value. In the example query below, the table structure is simple - name is of type text, and creation_date is of type timestamp. So when I do something like server_pg_module:query("select name from new_table where current_timestamp - creation_date >,file => >, line => >, message => >, routine => >,severity => >, {unknown,86} => >}}} And when I pass '2 days' as the parameter, it throws a badarg error.
Asked by ahron (833 rep)
Jun 2, 2018, 03:14 PM
Last activity: May 23, 2021, 01:33 AM