Francisco Reyes <lists@natserv.com> writes:
> Trying the following simple sql file:
> \set proc_date 6/30/2004
> \echo Date is :proc_date
> select * from feeds where date = :proc_date limit 20;
That's going to expand to
select * from feeds where date = 6/30/2004 limit 20;
whereas what you need is
select * from feeds where date = '6/30/2004' limit 20;
It's fairly painful to get single quotes into a psql variable;
AFAIK you have to do it like this:
\set proc_date '\'6/30/2004\''
regards, tom lane