Re: problem porting MySQL SQL to Postgres

Поиск
Список
Период
Сортировка
От Reinoud van Leeuwen
Тема Re: problem porting MySQL SQL to Postgres
Дата
Msg-id 20040415095556.GA709@spoetnik.xs4all.nl
обсуждение исходный текст
Ответ на problem porting MySQL SQL to Postgres  (Dan Field <dof@llgc.org.uk>)
Список pgsql-sql
On Thu, Apr 15, 2004 at 11:25:59AM +0100, Dan Field wrote:
> I've stumbled across a query I don't quite understand the error message 
> for.
> 
> This query is pulled from a working MySQL setup:
> 
> SELECT
>     DEWEY_ID, DEWEY_HUNDREDS, DEWEY_TENS, DEWEY_ONES,  DEWEY_POINT_ONES, 
> DEWEY_POINT_TENS,     
>     DEWEY_POINT_HUNDREDS, DEWEY_POINT_THOUSANDS,      DEWEY_TYPE, 
>     DEWEY_LANG, DEWEY_SUBJECT  FROM lu_dewey
> WHERE
>     (DEWEY_HUNDREDS = 9) AND
>     (DEWEY_TENS >= 0) AND     
>     (DEWEY_TENS <= 9) AND
>     (DEWEY_ONES = 0 || DEWEY_ONES = NULL) AND
>     (DEWEY_POINT_ONES = 0 || DEWEY_POINT_ONES = NULL) AND
>     (DEWEY_POINT_TENS = 0 || DEWEY_POINT_TENS = NULL) AND
>     (DEWEY_POINT_HUNDREDS = 0 || DEWEY_POINT_HUNDREDS = NULL) AND
>     (DEWEY_POINT_THOUSANDS = 0 || DEWEY_POINT_THOUSANDS = NULL) AND

please use 'IS NULL' instead of '= NULL'

>     (DEWEY_TYPE = 't') AND
>     (DEWEY_LANG = 'en')
> ORDER BY DEWEY_TENS
> 
> 
> However I'm getting the following error:
> 
>  ERROR:  Unable to identify an operator '=' for types 'character' and 
> 'boolean' You will have to retype this query using an explicit cast.

can you post the output of '\d lu_dewey'?

-- 
__________________________________________________
"Nothing is as subjective as reality"
Reinoud van Leeuwen    reinoud.v@n.leeuwen.net
http://www.xs4all.nl/~reinoud
__________________________________________________


В списке pgsql-sql по дате отправления:

Предыдущее
От: Dan Field
Дата:
Сообщение: problem porting MySQL SQL to Postgres
Следующее
От: Paul Thomas
Дата:
Сообщение: Re: problem porting MySQL SQL to Postgres