pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter van Heck <usenet@heckwork.nl>
To: pgsql-odbc@postgresql.org
Subject: Re: ERROR: invalid input syntax for type boolean: "-"(#7)
Date: Mon, 04 Oct 2004 16:21:18 +0200
Message-ID: <41615c55$0$140$e4fe514c@dreader17.news.xs4all.nl> (raw)
References: <E7F85A1B5FF8D44C8A1AF6885BC9A0E4306878@ratbert.vale-housing.co.uk>

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



view thread (4+ messages)

Message-ID: <41615c55$0$140$e4fe514c@dreader17.news.xs4all.nl>
Permalink:  ../41615c55$0$140$e4fe514c@dreader17.news.xs4all.nl/
Also on:    postgresql.org/message-id/41615c55$0$140$e4fe514c@dreader17.news.xs4all.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: usenet@heckwork.nl
  Subject: Re: ERROR: invalid input syntax for type boolean: "-"(#7)
  In-Reply-To: <41615c55$0$140$e4fe514c@dreader17.news.xs4all.nl>
  References: <E7F85A1B5FF8D44C8A1AF6885BC9A0E4306878@ratbert.vale-housing.co.uk> <41615c55$0$140$e4fe514c@dreader17.news.xs4all.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox