Where condition doesn't work as expected

From: William Colls <william(at)williamcollsassoc(dot)ca>
To: pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Where condition doesn't work as expected
Date: 2020-02-08 22:39:32
Message-ID: c01c8c2d-e9ec-03a1-4d13-282f084143f5@williamcollsassoc.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have the following condition a select statement:

 WHERE "datetime" > '2019-03-31 23:59:59'

datetime is a character field with data in the format YYYY-MM-DD
HH:MM:SS. However it returns any line where the datetime field begins
with 2019. I suspect that I should be using timestamp values, but I
can't figure out how to cast the datetime field value to a timestamp.

Thanks for your time.

William.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Ken Benson 2020-02-08 22:43:46 RE: Where condition doesn't work as expected
Previous Message ALT SHN 2020-02-08 09:32:20 Re: Coalesce in PostgreSQL trigger does not fire on upddate