X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5CB29329DB7 for ; Mon, 4 Oct 2004 15:38:22 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29545-06 for ; Mon, 4 Oct 2004 14:38:16 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 12AFB329FA8 for ; Mon, 4 Oct 2004 15:38:19 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i94EcEbx031844 for ; Mon, 4 Oct 2004 14:38:14 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i94EL6tv025732 for pgsql-odbc@postgresql.org; Mon, 4 Oct 2004 14:21:06 GMT From: Peter van Heck X-Newsgroups: comp.databases.postgresql.interfaces.odbc Subject: Re: ERROR: invalid input syntax for type boolean: "-"(#7) Date: Mon, 04 Oct 2004 16:21:18 +0200 Organization: Heckwork Development References: X-Newsreader: slrn/0.9.8.0 (Linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 55 Message-ID: <41615c55$0$140$e4fe514c@dreader17.news.xs4all.nl> To: pgsql-odbc@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200410/80 X-Sequence-Number: 4555 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