Re: Perl::DBI and interval syntax

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Allen <dba(at)girders(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Perl::DBI and interval syntax
Date: 2005-11-08 09:02:04
Message-ID: 20051108090204.GA25050@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 07, 2005 at 05:58:04PM -0500, Tom Lane wrote:
> Allen <dba(at)girders(dot)org> writes:
> > SELECT count(*) from post where post_ts >= current_date - interval ?
>
> This is not right, and never has been right, even though it may have
> accidentally failed to fail with some client libraries. Try
> CAST(? as interval) (SQL standard)
> ?::interval (Postgres-ism)
>
> The "interval something" syntax is only legal when "something" is
> a bare string literal.

This seems to be an example of breakage caused by DBI switching from
"substitute params in client" to "use new protocol to substitute params
in server" (prepare/execute).

AIUI, if you disable use of the new protocol, it should work as before.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message chidambaramchand 2005-11-08 09:03:56 unsubscribe
Previous Message Richard Huxton 2005-11-08 08:25:48 Re: odbc in postgresql and php