Re: Fw: ERROR: operator does not exist: date ~~ unknown - Mailing list pgsql-sql

From Tom Lane
Subject Re: Fw: ERROR: operator does not exist: date ~~ unknown
Date
Msg-id 25843.1239549409@sss.pgh.pa.us
Whole thread Raw
In response to Fw: ERROR: operator does not exist: date ~~ unknown  (Rohit Suman <handsome_94@yahoo.com>)
List pgsql-sql
Rohit Suman <handsome_94@yahoo.com> writes:
> Ya...I simply changed column type to text and it worked. :D
> I had requirements where I needed such a functionality. There was no way to do it any other way...

You should really, really take a second look at those "requirements".
Applying a textual pattern match to a date is a horrid idea for a number
of reasons, most notably that it's just about certain to break if
someone changes DateStyle.  Think about what it is you really want to
do (select a particular year, perhaps?) and see if there's not a
datetime-based operation that does it.
        regards, tom lane


pgsql-sql by date:

Previous
From: Rohit Suman
Date:
Subject: Fw: ERROR: operator does not exist: date ~~ unknown
Next
From: Dirk Jagdmann
Date:
Subject: Re: ENUM vs DOMAIN vs FKyed loookup table