| From: | Arjen Nienhuis <a(dot)g(dot)nienhuis(at)gmail(dot)com> | 
|---|---|
| To: | Roberto Balarezo <rober710(at)gmail(dot)com> | 
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: Fwd: Query parameter types not recognized | 
| Date: | 2017-02-10 21:33:38 | 
| Message-ID: | CAG6W84JRY7y=Go5FrM4WzwFrYVDKXvM5jPa6CBHpcnTSegAEuA@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Feb 10, 2017 8:11 PM, "Roberto Balarezo" <rober710(at)gmail(dot)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:
https://www.postgresql.org/docs/9.6/static/functions-datetime.html
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Roberto Balarezo | 2017-02-10 21:43:52 | Re: Fwd: Query parameter types not recognized | 
| Previous Message | Adrian Klaver | 2017-02-10 21:32:26 | Re: Fwd: Query parameter types not recognized |