[Info-ingres] why is an empty string an integer
aw at rationalcommerce.com
aw at rationalcommerce.com
Wed Jul 29 07:17:59 UTC 2020
MorningIf you use zero instead of 1 do you get the same?I must admit i have not seen that 'when a is integer/float' syntax before.But then i use openroad so our syntax is about 20 years behind.Adrian------ Original message------From: Martin BowesDate: Wed, 29 Jul 2020 08:01To: Ingres lists;Cc: 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/ca911005/attachment.html>
More information about the Info-ingres
mailing list