Re: Fw: ERROR: operator does not exist: date ~~ unknown

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rohit Suman <handsome_94(at)yahoo(dot)com>
Cc: pavel(dot)stehule(at)gmail(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: Fw: ERROR: operator does not exist: date ~~ unknown
Date: 2009-04-12 15:16:49
Message-ID: 25843.1239549409@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rohit Suman <handsome_94(at)yahoo(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dirk Jagdmann 2009-04-12 18:08:38 Re: ENUM vs DOMAIN vs FKyed loookup table
Previous Message Rohit Suman 2009-04-12 09:50:22 Fw: ERROR: operator does not exist: date ~~ unknown