Domains, casts, and MS Access

Поиск
Список
Период
Сортировка
От Peter Koczan
Тема Domains, casts, and MS Access
Дата
Msg-id AANLkTi=3HQborwBRTMfiPtKDFzRzQLtkHJ-E=m31vkUT@mail.gmail.com
обсуждение исходный текст
Ответы Re: Domains, casts, and MS Access  (Richard Broersma <richard.broersma@gmail.com>)
Список pgsql-sql
Hi all,

I'm working on porting an old MS Access form application from Sybase
to postgres/ODBC as part of a larger database port project.

One of the snags that's popped up is that there's some incompatibility
between data types. Specifically, many fields are the Sybase type
"bit", which is basically a boolean, but it accepts and displays
bareword 1 and 0 instead of 't' and 'f'. For the sake of compatibility
(especially bareword integers in queries), I've defined a 'sybit' type
in postgres to be a domain.

=> create domain sybit as smallint check ( value in (0,1) );

That is compatible behavior for most applications, but Access gets
confused since it wants to map it to an integer instead of a boolean
(it does the right thing for a native Sybase driver). I thought that
creating casts between sybit and boolean might help, but that won't
work so much it seems.

=# create cast (sybit as smallint) without function as implicit;
CREATE CAST
=# create cast (sybit as integer) with function int4(smallint) as implicit;
CREATE CAST
=# create cast (sybit as boolean) with function bool(integer) as assignment;
ERROR:  argument of cast function must match or be binary-coercible
from source data type

Is there a way to tell Access to do the right thing, or is there a
better way to define the type/domain, or is there some better product
to use?

Thanks much,
Peter

P.S. In case people are interested in the specifics of the sybase
"bit" type, you can look at
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.blocks/html/blocks/blocks54.htm.


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

Предыдущее
От: Kenneth Marshall
Дата:
Сообщение: Re: Some quick questions
Следующее
От: John Hasler
Дата:
Сообщение: Re: What does PostgreSQL do when time goes backward?