pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ODBC-client->Linux-server: datatype boolean not recognized?
4+ messages / 3 participants
[nested] [flat]

* ODBC-client->Linux-server: datatype boolean not recognized?
@ 1999-09-30 10:39 Jelle Ruttenberg <ruttenberg@neroc.nl>
  1999-09-30 12:47 ` Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not recognized? jose soares <jose@sferacarta.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Jelle Ruttenberg @ 1999-09-30 10:39 UTC (permalink / raw)
  To: pgsql-interfaces; +Cc: postgresql-general <pgsql-general@postgresql.org>; postgresql-bugs <pgsql-bugs@postgresql.org>

Hello all,

I'm trying to connect from a ODBC-client to PostgreSQL on a Linux-server. 
All is going well, except that the ODBC-client seems not to recognize the 
PostgreSQL boolean-datatype.

Is this really caused by PostgreSQL? If yes: is there a workaround, like 
altering the datatypename in the proper places (pg_type?)? If no: then it 
is another problem and can somebody give a hint?

Thanks,
Jelle.


I tested and encountered it in the following testsituations:

Situation 1:
Client: Mac via OpenLink ODBC-Client
Server: Linux RH 6.0 via OpenLink Requestbroker
Result: it looks like PostgreSQL-boolean is converted to SQL_C_CHAR

Situation 2:
Client: NT with psqlODBC
Server: same Linux
Result: in MS-Query:
-  viewing the table-definitions, it comes with the message that it 
doesn't recognize datatype 'bool'
-  selecting values it looks like PostgreSQL-boolean is converted to a 
numeric

PostgreSQL: 6.5.1


--------------------------------------------------------------
                   NEROC Publishing Solutions

                      Jelle Ruttenberg

De Run 1131, 5503 LB Veldhoven    Phone  : +31-(0)40-2586641
P.O.Box 133, 5500 AC Veldhoven    Fax    : +31-(0)40-2541893
The Netherlands                   E-mail : ruttenberg@neroc.nl
--------------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not recognized?
  1999-09-30 10:39 ODBC-client->Linux-server: datatype boolean not recognized? Jelle Ruttenberg <ruttenberg@neroc.nl>
@ 1999-09-30 12:47 ` jose soares <jose@sferacarta.com>
  1999-09-30 15:24   ` Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not recognized? Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
  0 siblings, 1 reply; 4+ messages in thread

From: jose soares @ 1999-09-30 12:47 UTC (permalink / raw)
  To: Jelle Ruttenberg <ruttenberg@neroc.nl>; +Cc: pgsql-interfaces; postgresql-general <pgsql-general@postgresql.org>; postgresql-bugs <pgsql-bugs@postgresql.org>

I had the same problem using m$access as client because m$access treats the
boolean value like an integer
0=false and -1=true while PostgreSQL treats the same value like a string (
'true','t','1','y','yes','false','f','0','n','no').
I created the following function and operator and now it works.

create function MsAccessBool(bool,int4)  returns bool
  as '' language 'internal';

create operator = (
        leftarg=bool,
        rightarg=int4,
        procedure=MsAccessBool,
        commutator='=',
        negator='<>',
        restrict=eqsel,
        join=eqjoinsel
        );

José

PS: remember to uncheck the field: "Bools as char" in the ODBC manager.


Jelle Ruttenberg ha scritto:

> Hello all,
>
> I'm trying to connect from a ODBC-client to PostgreSQL on a Linux-server.
> All is going well, except that the ODBC-client seems not to recognize the
> PostgreSQL boolean-datatype.
>
> Is this really caused by PostgreSQL? If yes: is there a workaround, like
> altering the datatypename in the proper places (pg_type?)? If no: then it
> is another problem and can somebody give a hint?
>
> Thanks,
> Jelle.
>
> I tested and encountered it in the following testsituations:
>
> Situation 1:
> Client: Mac via OpenLink ODBC-Client
> Server: Linux RH 6.0 via OpenLink Requestbroker
> Result: it looks like PostgreSQL-boolean is converted to SQL_C_CHAR
>
> Situation 2:
> Client: NT with psqlODBC
> Server: same Linux
> Result: in MS-Query:
> -  viewing the table-definitions, it comes with the message that it
> doesn't recognize datatype 'bool'
> -  selecting values it looks like PostgreSQL-boolean is converted to a
> numeric
>
> PostgreSQL: 6.5.1
>
> --------------------------------------------------------------
>                    NEROC Publishing Solutions
>
>                       Jelle Ruttenberg
>
> De Run 1131, 5503 LB Veldhoven    Phone  : +31-(0)40-2586641
> P.O.Box 133, 5500 AC Veldhoven    Fax    : +31-(0)40-2541893
> The Netherlands                   E-mail : ruttenberg@neroc.nl
> --------------------------------------------------------------
>
> ************




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not recognized?
  1999-09-30 10:39 ODBC-client->Linux-server: datatype boolean not recognized? Jelle Ruttenberg <ruttenberg@neroc.nl>
  1999-09-30 12:47 ` Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not recognized? jose soares <jose@sferacarta.com>
@ 1999-09-30 15:24   ` Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
  1999-10-01 15:14     ` Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not recognized? jose soares <jose@sferacarta.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Moray McConnachie @ 1999-09-30 15:24 UTC (permalink / raw)
  To: jose soares <jose@sferacarta.com>; +Cc: postgresql-general <pgsql-general@postgresql.org>



>create function MsAccessBool(bool,int4)  returns bool
>  as '' language 'internal';

There is surely something missing here, between the empty single
quotes? When I execute that, I get "There is no internal function
msaccessbool"





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not recognized?
  1999-09-30 10:39 ODBC-client->Linux-server: datatype boolean not recognized? Jelle Ruttenberg <ruttenberg@neroc.nl>
  1999-09-30 12:47 ` Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not recognized? jose soares <jose@sferacarta.com>
  1999-09-30 15:24   ` Re: [GENERAL] ODBC-client->Linux-server: datatype boolean not recognized? Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
@ 1999-10-01 15:14     ` jose soares <jose@sferacarta.com>
  0 siblings, 0 replies; 4+ messages in thread

From: jose soares @ 1999-10-01 15:14 UTC (permalink / raw)
  To: Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>; +Cc: postgresql-general <pgsql-general@postgresql.org>

oh! this was for old releases, now I'm using the following:

create function MsBool(bool,int4) returns bool as '
declare
        bool_int int4;
begin
        if $1 is NULL 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=MsBool,
        commutator='=',
        negator='!=',
        restrict=eqsel,
        join=eqjoinsel
        );



Moray McConnachie ha scritto:

> >create function MsAccessBool(bool,int4)  returns bool
> >  as '' language 'internal';
>
> There is surely something missing here, between the empty single
> quotes? When I execute that, I get "There is no internal function
> msaccessbool"

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~1999-10-01 15:14 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-09-30 10:39 ODBC-client->Linux-server: datatype boolean not recognized? Jelle Ruttenberg <ruttenberg@neroc.nl>
1999-09-30 12:47 ` jose soares <jose@sferacarta.com>
1999-09-30 15:24   ` Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
1999-10-01 15:14     ` jose soares <jose@sferacarta.com>

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