Re: [GENERAL] Fwd: Query parameter types not recognized - Mailing list pgsql-general

From Arjen Nienhuis
Subject Re: [GENERAL] Fwd: Query parameter types not recognized
Date
Msg-id CAG6W84JRY7y=Go5FrM4WzwFrYVDKXvM5jPa6CBHpcnTSegAEuA@mail.gmail.com
Whole thread Raw
In response to [GENERAL] Fwd: Query parameter types not recognized  (Roberto Balarezo <rober710@gmail.com>)
Responses Re: [GENERAL] Fwd: Query parameter types not recognized  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: [GENERAL] Fwd: Query parameter types not recognized  (Roberto Balarezo <rober710@gmail.com>)
List pgsql-general


On Feb 10, 2017 8:11 PM, "Roberto Balarezo" <rober710@gmail.com> wrote:
Hi, I would like to know why this is happening and some advice if there is a way to solve this problem:

I have a query like this:

select COALESCE(duedate, ? + 1) from invoices order by duedate desc limit 10;

where ? is a query parameter. I’m using JDBC to connect to the database, and sending parameters like this:

query.setDate(1, defaultDueDate);

If you want to add to a date you cannot just add 1. You need an interval: coalesce(duedate, ? + interval '1 day')

See:

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] Fwd: Query parameter types not recognized
Next
From: Roberto Balarezo
Date:
Subject: Re: [GENERAL] Fwd: Query parameter types not recognized