freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "James K. Lowden" <james.k.lowden AT icloud.com>
- To: freetds AT lists.ibiblio.org
- Subject: Re: [freetds] empty strings select as null bug
- Date: Wed, 10 Jun 2015 22:07:13 -0400
On Wed, 10 Jun 2015 15:37:59 -0700
Geoff Montee <geoff.montee AT gmail.com> wrote:
> tds_fdw assumes a column is NULL if dbdatlen() returns 0:
>
> https://github.com/GeoffMontee/tds_fdw/blob/fd4696695149b0be143e11b70df14b42acdd899d/src/tds_fdw.c#L1816
>
> http://www.freetds.org/reference/a00341.html#gae666d141533126babb0235af21bdca0f
>
> I implemented it this way because I assumed dbdatlen() should be equal
> to 1 for a null terminator character if a string is empty. Let me know
> if this is a bad null test.
Using dbdatlen, you cannot distinguish between a zero-length string and
NULL. In some versions of TDS, there is no difference between the
two: at the protocol level, a NULL CHAR column was indicated by having
a length of zero. Later versions indicated NULL explicitly. That
opened the possibilty of a non-NULL CHAR field having no data, a very
strange situtation indeed.
IIRC NULL can be more accurately detected with dbnullbind.
HTH.
--jkl
-
[freetds] empty strings select as null bug,
Jeffrey Shaw, 06/10/2015
-
Re: [freetds] empty strings select as null bug,
Geoff Montee, 06/10/2015
-
Re: [freetds] empty strings select as null bug,
James K. Lowden, 06/10/2015
- Re: [freetds] empty strings select as null bug, Geoff Montee, 06/10/2015
-
Re: [freetds] empty strings select as null bug,
LacaK, 06/11/2015
-
Re: [freetds] empty strings select as null bug,
Geoff Montee, 06/11/2015
- Re: [freetds] empty strings select as null bug, Jeffrey Shaw, 06/11/2015
- Re: [freetds] empty strings select as null bug, Jeffrey Shaw, 06/11/2015
-
Re: [freetds] empty strings select as null bug,
Geoff Montee, 06/11/2015
-
Re: [freetds] empty strings select as null bug,
James K. Lowden, 06/10/2015
-
Re: [freetds] empty strings select as null bug,
Geoff Montee, 06/10/2015
Archive powered by MHonArc 2.6.24.