Is it possible to pass Date value without single quotes in select statements
Query :
select * from Schema_1.table_name where "Date" >=2019-01-01 and "Date"<=2020-12-01
Instead of
select * from Schema_1.table_name where "Date" >='2019-01-01' and "Date"<='2020-12-01'
Thanks in advance
2
Answers
Yes. You can replace them with (named) dollar quotes
$$
: demo at db<>fiddleThe
make_date()
function accepts the year, month and day as integers, so you can get away without quotes of any kind:Technically, you could also cast a date-looking integer to
::text
first, then to a::date
, if you like being controversial:PostgreSQL provides another way, called “dollar quoting”, to write string constants, example
Check the official documentation, for further info