Re: MySQL search query is not executing in Postgres DB

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Marti Raudsepp <marti(at)juffo(dot)org>
Cc: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, premanand <kottiprem(at)gmail(dot)com>
Subject: Re: MySQL search query is not executing in Postgres DB
Date: 2012-02-17 16:19:06
Message-ID: CAOR=d=2-8q-0P5GKCBgquHbW-ZC7+acrT_VFB0DVHf9KVhDfKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 17, 2012 at 9:01 AM, Marti Raudsepp <marti(at)juffo(dot)org> wrote:
> On Fri, Feb 17, 2012 at 17:13, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> wrote:
>> Why not use:
>> " SELECT * FROM <Table-name> WHERE CAST(Table.ID as TEXT) LIKE '1%' "
>>
>> as the MySQL query also?  MySQL supports the CAST function.
>
> Nope, trying to use CAST() in an interoperable manner is a lost cause.
> Sadly MySQL and PostgreSQL don't agree over the cast types. MySQL's
> CAST doesn't recognize varchar or text. Both support CHAR, but they
> work differently (MySQL's char behaves like PostgreSQL's varchar):

Have you tried casting to varchar(1000) or something like that?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marti Raudsepp 2012-02-17 16:21:07 Re: Set returning functions in select column list
Previous Message Marti Raudsepp 2012-02-17 16:01:36 Re: MySQL search query is not executing in Postgres DB