Re: Perl::DBI and interval syntax

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Allen <dba(at)girders(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Perl::DBI and interval syntax
Date: 2005-11-07 22:58:04
Message-ID: 29275.1131404284@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-11-07 23:16:58 Re: [HACKERS] Help with Array Function in C language...
Previous Message Cristian Prieto 2005-11-07 22:51:51 Help with Array Function in C language...