[Info-ingres] why is an empty string an integer
Martin Bowes
martin.bowes at ndph.ox.ac.uk
Wed Jul 29 07:12:16 UTC 2020
Forgot to mention this is on version II 11.0.0 (a64.lnx/100) +p15426
I also see it on: II 11.1.0 (a64.lnx/100) + p15550
Marty
From: Martin Bowes <martin.bowes at ndph.ox.ac.uk>
Sent: 29 July 2020 08:02
To: Ingres lists <info-ingres at lists.planetingres.org>
Subject: [Info-ingres] why is an empty string an integer
Hi All,
I may have come across this before, but it's early and I haven't had my coffee.
declare global temporary table fred(
a varchar(20)
) on commit preserve rows with norecovery;
Executing . . .
continue
* * insert into fred values (null), (''), ('1'), ('13-jan-2020');
Executing . . .
(4 rows)
continue
* * * * * * * * select case when a is null then 'null'
when a = '' then 'empty string'
else a end as data,
case when a is integer then 'integer' else 'not integer' end as is_integer,
case when a is float then 'float' else 'not float' end as is_float,
case when a is ansidate then 'ansidate' else 'not ansidate' end as is_ansidate
from fred;
Executing . . .
┌────────────────────┬───────────┬─────────┬────────────┐
│data │is_integer │is_float │is_ansidate │
├────────────────────┼───────────┼─────────┼────────────┤
│null │not integer│not float│not ansidate│
│empty string │integer │float │not ansidate│
│1 │integer │float │not ansidate│
│13-jan-2020 │not integer│not float│ansidate │
└────────────────────┴───────────┴─────────┴────────────┘
(4 rows)
continue
Now the tests with nulls behave as I expect. But the empty string cases I did not expect. Is this a bug? Documented behaviour?
Martin Bowes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.planetingres.org/pipermail/info-ingres/attachments/20200729/666471d2/attachment.html>
More information about the Info-ingres
mailing list