Re: Perl::DBI and interval syntax - Mailing list pgsql-general

From Tom Lane
Subject Re: Perl::DBI and interval syntax
Date
Msg-id 29275.1131404284@sss.pgh.pa.us
Whole thread Raw
In response to Perl::DBI and interval syntax  (Allen <dba@girders.org>)
Responses Re: Perl::DBI and interval syntax  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Allen <dba@girders.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

pgsql-general by date:

Previous
From: "Cristian Prieto"
Date:
Subject: Help with Array Function in C language...
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Help with Array Function in C language...