I can't work out how to pass a variable into the postgresql extract function like:
select 'day' as i;
extract(i from a_date)
that gives me
ERROR: timestamp with time zone units "i" not recognized
If I can pass in a string, extract('day' from a_date), why not a variable ?
SELECT INTO i 'day';ori := 'day';Your example does not provide enough context to properly answer the question.