pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ERROR:  operator does not exist: date ~~ unknown
4+ messages / 3 participants
[nested] [flat]

* ERROR:  operator does not exist: date ~~ unknown
@ 2009-04-12 05:58 Rohit Suman <handsome_94@yahoo.com>
  2009-04-12 07:36 ` Re: ERROR: operator does not exist: date ~~ unknown Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Rohit Suman @ 2009-04-12 05:58 UTC (permalink / raw)
  To: pgsql-sql

Hi

I've a table bins in which I've a column named "Date In"  which stores values of "Date" type. I've postgresql 8.3.5

Now when I execute query " select * from bins where "Date In" like '%'; "I get the folowing error :



SQL error:

ERROR:  operator does not exist: date ~~ unknown
LINE 1: select * from bins where "Date In" like '%';
                                           ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
In statement:
select * from bins where "Date In" like '%';
Please help...I'm stuck for like 3-4 hours now on this X_X

Rohit



      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: ERROR: operator does not exist: date ~~ unknown
  2009-04-12 05:58 ERROR:  operator does not exist: date ~~ unknown Rohit Suman <handsome_94@yahoo.com>
@ 2009-04-12 07:36 ` Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Pavel Stehule @ 2009-04-12 07:36 UTC (permalink / raw)
  To: Rohit Suman <handsome_94@yahoo.com>; +Cc: pgsql-sql

Hello

it means - there are not operator LIKE for datatype date. Why do you
do it? Try to look on date_part or extract functions.

Fast solution, bot not optimal, is cast date to text via function
to_char(date, 'mask')

regards
Pavel Stehule


2009/4/12 Rohit Suman <handsome_94@yahoo.com>:
> Hi
>
> I've a table bins in which I've a column named "Date In"  which stores
> values of "Date" type. I've postgresql 8.3.5
>
> Now when I execute query " select * from bins where "Date In" like '%'; " I
> get the folowing error :
>
>
> SQL error:
>
> ERROR:  operator does not exist: date ~~ unknown
> LINE 1: select * from bins where "Date In" like '%';
>                                            ^
> HINT:  No operator matches the given name and argument type(s). You might
> need to add explicit type casts.
>
> In statement:
> select * from bins where "Date In" like '%';
>
> Please help...I'm stuck for like 3-4 hours now on this X_X
>
> Rohit
>
> ________________________________
> Add more friends to your messenger and enjoy! Invite them now.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Fw: ERROR: operator does not exist: date ~~ unknown
@ 2009-04-12 09:50 Rohit Suman <handsome_94@yahoo.com>
  2009-04-12 15:16 ` Re: Fw: ERROR: operator does not exist: date ~~ unknown Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Rohit Suman @ 2009-04-12 09:50 UTC (permalink / raw)
  To: pavel.stehule@gmail.com; +Cc: pgsql-sql

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...

Thanks man



----- Forwarded Message ----
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Rohit Suman <handsome_94@yahoo.com>
Cc: pgsql-sql@postgresql.org
Sent: Sunday, 12 April, 2009 1:06:16 PM
Subject: Re: [SQL] ERROR: operator does not exist: date ~~ unknown

Hello

it means - there are not operator LIKE for datatype date. Why do you
do it? Try to look on date_part or extract functions.

Fast solution, bot not optimal, is cast date to text via function
to_char(date, 'mask')

regards
Pavel Stehule


2009/4/12 Rohit Suman <handsome_94@yahoo.com>:
> Hi
>
> I've a table bins in which I've a column named "Date In"  which stores
> values of "Date" type. I've postgresql 8.3.5
>
> Now when I execute query " select * from bins where "Date In" like '%'; " I
> get the folowing error :
>
>
> SQL error:
>
> ERROR:  operator does not exist: date ~~ unknown
> LINE 1: select * from bins where "Date In" like '%';
>                                            ^
> HINT:  No operator matches the given name and argument type(s). You might
> need to add explicit type casts.
>
> In statement:
> select * from bins where "Date In" like '%';
>
> Please help...I'm stuck for like 3-4 hours now on this X_X
>
> Rohit
>
> ________________________________
> Add more friends to your messenger and enjoy! Invite them now.



      Get perfect Email ID for your Resume. Grab now http://in.promos.yahoo.com/address

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Fw: ERROR: operator does not exist: date ~~ unknown
  2009-04-12 09:50 Fw: ERROR: operator does not exist: date ~~ unknown Rohit Suman <handsome_94@yahoo.com>
@ 2009-04-12 15:16 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2009-04-12 15:16 UTC (permalink / raw)
  To: Rohit Suman <handsome_94@yahoo.com>; +Cc: pavel.stehule@gmail.com; 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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2009-04-12 15:16 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-04-12 05:58 ERROR:  operator does not exist: date ~~ unknown Rohit Suman <handsome_94@yahoo.com>
2009-04-12 07:36 ` Re: ERROR: operator does not exist: date ~~ unknown Pavel Stehule <pavel.stehule@gmail.com>
2009-04-12 09:50 Fw: ERROR: operator does not exist: date ~~ unknown Rohit Suman <handsome_94@yahoo.com>
2009-04-12 15:16 ` Re: Fw: ERROR: operator does not exist: date ~~ unknown Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox