Re: ERROR: invalid input syntax for type boolean: "-"(#7)

Поиск
Список
Период
Сортировка
От Peter van Heck
Тема Re: ERROR: invalid input syntax for type boolean: "-"(#7)
Дата
Msg-id 41615c55$0$140$e4fe514c@dreader17.news.xs4all.nl
обсуждение исходный текст
Ответ на Re: ERROR: invalid input syntax for type boolean: "-"(#7)  ("Dave Page" <dpage@vale-housing.co.uk>)
Список pgsql-odbc
On Fri, 1 Oct 2004 20:55:54 +0100, dpage@vale-housing.co.uk ("Dave
Page") wrote:

>> -----Original Message-----
>> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Peter van Heck
>> Sent: 29 September 2004 02:53
>> Subject: [ODBC] ERROR: invalid input syntax for type boolean: "-"(#7)
>>
>> I get this error with an ms-access front-end boolean type
>> field where access produces "-1" and Postgresql's bool field
>> does not accept this.
>>
>> Im using Postgres 7.4.5, Access 2002, mdac 2.8, psqlodbc-07_03_0200.
>>
>> Is there a proper work around?
>
>There is a 'True is -1' option on the second options dialog.

This 'True is -1' option + "Bool as Char" unchecked in combination
with code mentioned below solved my problems what this concens.
Thanks, also to Amir:

DROP OPERATOR = (bool, int4);
DROP FUNCTION MsAccessBool (bool, int4);
CREATE FUNCTION MsAccessBool (bool, int4) RETURNS BOOL AS '
BEGIN
  IF $1 ISNULL THEN
    RETURN NULL;
  END IF;

  IF $1 IS TRUE THEN
    IF $2 <> 0 THEN
      RETURN TRUE;
    END IF;
  ELSE
    IF $2 = 0 THEN
      RETURN TRUE;
    END IF;
  END IF;
  RETURN FALSE;
END;
' LANGUAGE 'plpgsql';

CREATE OPERATOR = (
  LEFTARG = BOOL,
  RIGHTARG = INT4,
  PROCEDURE = MsAccessBool,
  COMMUTATOR = '=',
  NEGATOR = '<>',
  RESTRICT = EQSEL,
  JOIN = EQJOINSEL
);


Peter

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

Предыдущее
От: "Dave Page"
Дата:
Сообщение: Re: ODBC Snapshot Installer (for Dave Page)
Следующее
От: Karol Szkudlarek
Дата:
Сообщение: Re: Snapshot release 08.00.0002 uploaded