Newbie question about casting literals - oracle/postgres - Mailing list pgsql-general

From Naeem Bari
Subject Newbie question about casting literals - oracle/postgres
Date
Msg-id 53F35087CC531844AD19CCAE6FA669293690@util.agilissystems.com
Whole thread Raw
Responses Re: Newbie question about casting literals - oracle/postgres  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: Newbie question about casting literals - oracle/postgres  (Dianne Yumul <dianne@wellsgaming.com>)
Re: Newbie question about casting literals - oracle/postgres  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-general

Ok,

 

I have a query that runs fine in oracle:

 

   select driver_id, 'GREEN' as color, pos_date, pos_lat, pos_lon

   from driver_pos

   where driver_id = 1

   order by pos_date

 

The only way this works in postgres is by casting ‘GREEN’ to text using ‘GREEN’::text

 

The problem is then this does not work with oracle. Since my software has to support both databases, I am left in a bit of a bind. Any ideas on how to make postgres accept ‘GREEN’ as text without my having to spell it out by casting?

 

Thanks!

naeem

pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: list fieldnames in table? (from PHP)
Next
From: "Scott Marlowe"
Date:
Subject: Re: [Fwd: Abrupt close of pgsql backend]