Re: problem porting MySQL SQL to Postgres

Поиск
Список
Период
Сортировка
От Martin Marques
Тема Re: problem porting MySQL SQL to Postgres
Дата
Msg-id 200404150830.20125.martin@bugs.unl.edu.ar
обсуждение исходный текст
Ответ на problem porting MySQL SQL to Postgres  (Dan Field <dof@llgc.org.uk>)
Список pgsql-sql
El Jue 15 Abr 2004 07:25, Dan Field escribió:
> 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
>     (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.

1) Change the "= NULL" to "IS NULL" which is how it's defined in the SQL
standards.
2) What data type does DEWEY_TYPE have?

-- 08:28:01 up 37 days, 12:55,  2 users,  load average: 0.72, 0.77, 0.90
-----------------------------------------------------------------
Martín Marqués        | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador            Universidad Nacional                 del Litoral
-----------------------------------------------------------------



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

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