Jean-Christian Imbeault <jc@mega-bucks.co.jp> writes:
> As an aside, and for my own edificaton, what is the "correct" was to
> pass a date in as an SQL argument? Using '2003-01-01' works but it seems
> the parser is actually viewing this as text and not a date?
No. That is actually the preferred way to do it. A literal encased in
single quotes is not text to Postgres --- it is an untyped literal that
will be cast automatically to the datatype needed by its context. In
particular, given an expression like
columnref operator 'literal'
the untyped literal will preferentially be cast to the same datatype as
the column reference. (I believe the parser will explore other possible
interpretations if that one doesn't match any available operator, but
that will definitely be what's chosen if there's a matching operator.)
regards, tom lane