skip to Main Content

Postgresql – How set variable as date type in psql?

to_date can convert string into date: select to_date('2024-01-01','YYYY-MM-DD'); to_date ------------ 2024-01-01 (1 row) Let's check the data type: select pg_typeof(to_date('2024-01-01','YYYY-MM-DD')); pg_typeof ----------- date Why can't set an variable as date type? set mydate to_date('2024-01-01','YYYY-MM-DD') select :mydate; ERROR: column "yyyy" does…

VIEW QUESTION
Back To Top
Search