[DB-SIG] None and BOOLEAN columns
Federico Di Gregorio
fog@debian.org
06 Mar 2002 12:50:08 +0100
--=-84YnhbKyHWBX2eTYpURt
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Wed, 2002-03-06 at 12:28, Dittmar, Daniel wrote:
> What is the expected behaviour with regard to NULL, TRUE, FALSE and BOOLE=
AN
> columns?
>=20
> In the SAP DB driver, I translate None (or any other value interpreted as
> false) to a SQL False value, so there is currently no possibility to inse=
rt
> a real NULL value.
>=20
> On SELECT, I translate both NULL and FALSE to None.
>=20
> Admittedly, this comes from my own Python + SQL style, where I use None a=
s
> false on the Python side and try to stay away from three valued logic on =
the
> SQL side.
>=20
> What do other drivers do?
psycopg uses the following map:
NULL <-> None
False (postgres value is 'f') -> 0
True (postgres value is 't') -> 1
we are still discussion on the python to postgres conversion, because 0
and 1 can't be inserted in postgres (it expects t and f). i think
psycopg 1.1 will return two litle specialized objects for t and f that
work correctly in python 'if's and can be reinserted into the db.
ciao,
federico
--=20
Federico Di Gregorio
Debian GNU/Linux Developer & Italian Press Contact fog@debian.org
INIT.D Developer fog@initd.org
La felicit=E0 =E8 una tazza di cioccolata calda. Sempre. -- I=
o
--=-84YnhbKyHWBX2eTYpURt
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEABECAAYFAjyGAmsACgkQvcCgrgZGjevjuwCgiSrlwETAbHwyezAeWlJ5gbB8
5dUAn1INoYd+DvayKC/pE7/kNSbZlfBl
=encN
-----END PGP SIGNATURE-----
--=-84YnhbKyHWBX2eTYpURt--