From: | Peter van Heck <usenet(at)heckwork(dot)nl> |
---|---|
To: | pgsql-odbc(at)postgresql(dot)org |
Subject: | Re: ERROR: invalid input syntax for type boolean: "-"(#7) |
Date: | 2004-10-04 14:21:18 |
Message-ID: | 41615c55$0$140$e4fe514c@dreader17.news.xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
On Fri, 1 Oct 2004 20:55:54 +0100, dpage(at)vale-housing(dot)co(dot)uk ("Dave
Page") wrote:
>> -----Original Message-----
>> [mailto:pgsql-odbc-owner(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Fahey | 2004-10-04 15:48:20 | timestamp via odbc |
Previous Message | Dave Page | 2004-10-04 14:14:05 | Re: New snapshot 08.00.0001 uploaded |