• [Info-ingres] why is an empty string an integer

    From Martin Bowes@21:1/5 to Ingres lists on Wed Jul 29 07:12:16 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@ndph.ox.ac.uk>
    Sent: 29 July 2020 08:02
    To: Ingres lists <info-ingres@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

    <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
    <meta name="Generator" content="Microsoft Word 15 (filtered medium)"> <style><!--
    /* Font Definitions */
    @font-face
    {font-family:"Cambria Math";
    panose-1:2 4 5 3 5 4 6 3 2 4;}
    @font-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
    @font-face
    {font-family:"Lucida Console";
    panose-1:2 11 6 9 4 5 4 2 2 4;}
    /* Style Definitions */
    p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0cm;
    margin-bottom:.0001pt;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
    a:link, span.MsoHyperlink
    {mso-style-priority:99;
    color:#0563C1;
    text-decoration:underline;}
    a:visited, span.MsoHyperlinkFollowed
    {mso-style-priority:99;
    color:#954F72;
    text-decoration:underline;}
    p.msonormal0, li.msonormal0, div.msonormal0
    {mso-style-name:msonormal;
    mso-margin-top-alt:auto;
    margin-right:0cm;
    mso-margin-bottom-alt:auto;
    margin-left:0cm;
    font-size:12.0pt;
    font-family:"Times New Roman",serif;}
    span.EmailStyle18
    {mso-style-type:personal;
    font-family:"Calibri",sans-serif;
    color:windowtext;}
    span.EmailStyle19
    {mso-style-type:personal;
    font-family:"Calibri",sans-serif;
    color:#1F497D;}
    span.EmailStyle20
    {mso-style-type:personal-compose;
    font-family:"Calibri",sans-serif;
    color:windowtext;}
    .MsoChpDefault
    {mso-style-type:export-only;
    font-size:10.0pt;}
    @page WordSection1
    {size:612.0pt 792.0pt;
    margin:72.0pt 72.0pt 72.0pt 72.0pt;}
    div.WordSection1
    {page:WordSection1;}
    </style>
    </head>
    <body lang="EN-GB" link="#0563C1" vlink="#954F72">
    <div class="WordSection1">
    <p class="MsoNormal" style="text-autospace:none"><span style="color:#1F497D">Forgot to mention this is on version
    </span><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">II 11.0.0 (a64.lnx/100) &#43;p15426<o:p></o:p></span></p>
    <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal" style="text-autospace:none"><span style="color:#1F497D">I also see it on:
    </span><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">II 11.1.0 (a64.lnx/100) &#43; p15550<o:p></o:p></span></p>
    <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span style="color:#1F497D">Marty<o:p></o:p></span></p> <div>
    <div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
    <p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:EN-GB">From:</span></b><span lang="EN-US" style="mso-fareast-language:EN-GB"> Martin Bowes &lt;martin.bowes@ndph.ox.ac.uk&gt;

    <b>Sent:</b> 29 July 2020 08:02<br>
    <b>To:</b> Ingres lists &lt;info-ingres@lists.planetingres.org&gt;<br> <b>Subject:</b> [Info-ingres] why is an empty string an integer<o:p></o:p></span></p>
    </div>
    </div>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Hi All,<o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">I may have come across this before, but it&#8217;s early and I haven&#8217;t had my coffee.<o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">declare global temporary table fred(</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp; a varchar(20)</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">) on commit preserve rows with norecovery;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">* * insert into fred values (null), (''), ('1'), ('13-jan-2020');</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(4 rows)</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">* * * * * * * * select case when a is null then 'null'</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when a = '' then 'empty string'</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else a end as data,</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is integer then 'integer' else 'not integer' end as is_integer,</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case when a is float then 'float' else 'not float' end as is_float,</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is ansidate then 'ansidate' else 'not ansidate' end as is_ansidate</span><o:p></o:p></

    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">from fred;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">‚€€€€€€€€€€€€€€€€€€€€ˆ€€€€€€€€€€€ˆ€€€€€€€€€ˆ€€€€€€€€€€€€ƒ</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">data&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is_integer is_float is_ansidate </
    span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">†€€€€€€€€€€€€€€€€€€€€Š€€€€€€€€€€€Š€€€€€€€€€Š€€€€€€€€€€€€‡</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">null&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not integernot floatnot ansidate</
    span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">empty string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="background:yellow;mso-highlight:yellow">integer&nbsp;&nbsp;&nbsp;
    float</span>&nbsp;&nbsp;&nbsp; not ansidate</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; integer&nbsp;&nbsp;&
    nbsp; float&nbsp;&nbsp;&nbsp; not ansidate</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">13-jan-2020&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not integernot floatansidate&nbsp;&nbsp;&nbsp; </span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">„€€€€€€€€€€€€€€€€€€€€‰€€€€€€€€€€€‰€€€€€€€€€‰€€€€€€€€€€€€…</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(4 rows)</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue</span><o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">Now the tests with nulls behave as I expect. But the empty string cases I did not expect. Is this a bug? Documented behaviour?<o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">Martin Bowes<o:p></o:p></p>
    </div>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin Bowes@21:1/5 to Ingres lists on Wed Jul 29 07:01:41 2020
    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

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
    <meta name="Generator" content="Microsoft Word 15 (filtered medium)"> <style><!--
    /* Font Definitions */
    @font-face
    {font-family:"Cambria Math";
    panose-1:2 4 5 3 5 4 6 3 2 4;}
    @font-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
    @font-face
    {font-family:"Lucida Console";
    panose-1:2 11 6 9 4 5 4 2 2 4;}
    /* Style Definitions */
    p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0cm;
    margin-bottom:.0001pt;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
    a:link, span.MsoHyperlink
    {mso-style-priority:99;
    color:#0563C1;
    text-decoration:underline;}
    a:visited, span.MsoHyperlinkFollowed
    {mso-style-priority:99;
    color:#954F72;
    text-decoration:underline;}
    span.EmailStyle17
    {mso-style-type:personal-compose;
    font-family:"Calibri",sans-serif;
    color:windowtext;}
    .MsoChpDefault
    {mso-style-type:export-only;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
    @page WordSection1
    {size:612.0pt 792.0pt;
    margin:72.0pt 72.0pt 72.0pt 72.0pt;}
    div.WordSection1
    {page:WordSection1;}
    </style><!--[if gte mso 9]><xml>
    <o:shapedefaults v:ext="edit" spidmax="1026" />
    </xml><![endif]--><!--[if gte mso 9]><xml>
    <o:shapelayout v:ext="edit">
    <o:idmap v:ext="edit" data="1" />
    </o:shapelayout></xml><![endif]-->
    </head>
    <body lang="EN-GB" link="#0563C1" vlink="#954F72">
    <div class="WordSection1">
    <p class="MsoNormal">Hi All,<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">I may have come across this before, but it&#8217;s early and I haven&#8217;t had my coffee.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">declare global temporary table fred(<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp; a varchar(20)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">) on commit preserve rows with norecovery;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">* * insert into fred values (null), (''), ('1'), ('13-jan-2020');<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(4 rows)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">* * * * * * * * select case when a is null then 'null'<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when a = '' then 'empty string'<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else a end as data,<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is integer then 'integer' else 'not integer' end as is_integer,<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case when a is float then 'float' else 'not float' end as is_float,<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is ansidate then 'ansidate' else 'not ansidate' end as is_ansidate<o:p></o:p></span></

    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">from fred;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">‚€€€€€€€€€€€€€€€€€€€€ˆ€€€€€€€€€€€ˆ€€€€€€€€€ˆ€€€€€€€€€€€€ƒ<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">data&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is_integer is_float is_ansidate <o:
    </o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">†€€€€€€€€€€€€€€€€€€€€Š€€€€€€€€€€€Š€€€€€€€€€Š€€€€€€€€€€€€‡<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">null&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not integernot floatnot ansidate<o:
    </o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">empty string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="background:yellow;mso-highlight:yellow">integer&nbsp;&nbsp;&nbsp;
    float</span>&nbsp;&nbsp;&nbsp; not ansidate<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; integer&nbsp;&nbsp;&
    nbsp; float&nbsp;&nbsp;&nbsp; not ansidate<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">13-jan-2020&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not integernot floatansidate&nbsp;&nbsp;&nbsp; <o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">„€€€€€€€€€€€€€€€€€€€€‰€€€€€€€€€€€‰€€€€€€€€€‰€€€€€€€€€€€€…<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(4 rows)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue<o:p></o:p></span></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Now the tests with nulls behave as I expect. But the empty string cases I did not expect. Is this a bug? Documented behaviour?<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Martin Bowes<o:p></o:p></p>
    </div>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aw@rationalcommerce.com@21:1/5 to Martin Bowes on Wed Jul 29 08:17:59 2020
    To: info-ingres@lists.planetingres.org (Ingres lists)

    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


    <html><head>









    <style><!--&#10;/* Font Definitions */&#10;@font-face&#10; {font-family:"Cambria Math";&#10; panose-1:2 4 5 3 5 4 6 3 2 4;}&#10;@font-face&#10; {font-family:Calibri;&#10; panose-1:2 15 5 2 2 2 4 3 2 4;}&#10;@font-face&#10; {font-family:"Lucida Console";&#
    10; panose-1:2 11 6 9 4 5 4 2 2 4;}&#10;/* Style Definitions */&#10;p.MsoNormal, li.MsoNormal, div.MsoNormal&#10; {margin:0cm;&#10; margin-bottom:.0001pt;&#10; font-size:11.0pt;&#10; font-family:"Calibri",sans-serif;&#10; mso-fareast-language:EN-US;}&#10;
    a:link, span.MsoHyperlink&#10; {mso-style-priority:99;&#10; color:#0563C1;&#10; text-decoration:underline;}&#10;a:visited, span.MsoHyperlinkFollowed&#10; {mso-style-priority:99;&#10; color:#954F72;&#10; text-decoration:underline;}&#10;span.EmailStyle17&#
    10; {mso-style-type:personal-compose;&#10; font-family:"Calibri",sans-serif;&#10; color:windowtext;}&#10;.MsoChpDefault&#10; {mso-style-type:export-only;&#10; font-family:"Calibri",sans-serif;&#10;
    mso-fareast-language:EN-US;}&#10;@page WordSection1&#10; {size:612.0pt 792.0pt;&#10; margin:72.0pt 72.0pt 72.0pt 72.0pt;}&#10;div.WordSection1&#10; {page:WordSection1;}&#10;--></style><!--[if gte mso 9]><xml>&#10;<o:shapedefaults v:ext="edit" spidmax="
    1026" />&#10;</xml><![endif]--><!--[if gte mso 9]><xml>&#10;<o:shapelayout v:ext="edit">&#10;<o:idmap v:ext="edit" data="1" />&#10;</o:shapelayout></xml><![endif]-->
    </head>
    <body>
    <div style="font-size: 10pt;"><div dir="auto">Morning</div><div dir="auto"><br></div><div dir="auto">If you use zero instead of 1 do you get the same?</div><div dir="auto"><br></div><div dir="auto">I must admit i have not seen that 'when a is integer/
    float' syntax before.</div><div dir="auto"><br></div><div dir="auto">But then i use openroad so our syntax is about 20 years behind.</div><div dir="auto"><br></div><div dir="auto">Adrian</div></div><div style="font-size: 10pt;"><div id="LGEmailHeader"
    dir="auto"><div dir="auto"><br></div><div
    dir="auto">------ Original message------</div><div dir="auto"><b>From: </b>Martin Bowes<martin.bowes@ndph.ox.ac.uk></martin.bowes@ndph.ox.ac.uk></div><div dir="auto"><b>Date: </b>Wed, 29 Jul 2020 08:01</div><div dir="auto"><b>To: </b>Ingres lists;</div><
    div dir="auto"><b>Cc: </b></div><div dir="auto"><b>Subject:</b>[Info-ingres] why is an empty string an integer</div><div dir="auto"><br></div></div><div dir="auto">
    <div class="WordSection1">
    <p class="MsoNormal">Hi All,<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">I may have come across this before, but it’s early and I haven’t had my coffee.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">declare global temporary table fred(<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida
    Console&quot;">&nbsp;&nbsp;&nbsp; a varchar(20)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">) on commit preserve rows with norecovery;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">* * insert into fred values (null), (''), ('1'), ('13-jan-2020');<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span
    style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(4 rows)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">* * * * * * * * select case when a is null then 'null'<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when a = '' then 'empty string'<o:p></o:p></span></p>
    <p
    class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else a end as data,<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is integer then 'integer' else 'not integer' end as is_integer,<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case when a is float then 'float' else 'not float' end as is_float,<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is ansidate then 'ansidate' else 'not ansidate' end as is_ansidate<o:p></o:p></span></

    <p
    class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">from fred;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β
    ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">β”‚data&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;β”‚is_integer β”‚is_float β”‚is_ansidate β”‚<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β
    ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">β”‚null&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; β”‚not integerβ”‚not floatβ”‚not
    ansidateβ”‚<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">β”‚empty string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; β”‚<span style="background:yellow;mso-highlight:yellow">integer&nbsp;&nbsp;&
    nbsp; β”‚float</span>&nbsp;&nbsp;&nbsp; β”‚not ansidateβ”‚<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span
    style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">β”‚1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; β”‚integer&nbsp;&nbsp;&nbsp; β”‚float&nbsp;&nbsp;&nbsp; β”‚not ansidateβ”‚<o:
    </o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">β”‚13-jan-2020&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; β”‚not integerβ”‚not floatβ”‚ansidate&nbsp;&nbsp;&nbsp; β”‚<o:p></o:p></
    span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">└────────────────────┴───────────┴─────────┴─β
    ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(4 rows)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida
    Console&quot;">continue<o:p></o:p></span></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Now the tests with nulls behave as I expect. But the empty string cases I did not expect. Is this a bug? Documented behaviour?<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Martin Bowes<o:p></o:p></p>
    </div>
    </div></div>


    </body></html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Williamson@21:1/5 to Martin Bowes on Wed Jul 29 08:39:37 2020
    To: info-ingres@lists.planetingres.org (Ingres lists)

    This is a multipart message in MIME format.

    Hi,



    My guess is blank string is being translated to zero:



    * select integer('');\g

    Executing . . .





    +-------------+

    |col1 |

    +-------------+

    | 0|

    +-------------+



    Ingres 10.1 did not want to play with these new predicates, and my Ingres 11 did as yours.



    OpenROAD gave up here:





    insert into fred values (null), (''), ('1'), ('13-jan-2020');

    ^

    %% Error at line 11

    E_W400F0 Syntax error. The last symbol read was ','.



    Go figure.



    That’s why I don’t look at new SQL features – no point.



    Cheers



    Adrian



    From: Martin Bowes <martin.bowes@ndph.ox.ac.uk>
    Sent: 29 July 2020 08:25
    To: aw@rationalcommerce.com; Ingres lists <info-ingres@lists.planetingres.org> Subject: RE: [Info-ingres] why is an empty string an integer



    Hi Adrian,



    Yes zero works fine.



    The syntax is referred to as β€˜predicates’ and there are a whole host of them to do basic tests. I have found them extremely useful in doing data imports from less than reliable third parties.



    Marty



    From: aw@rationalcommerce.com <mailto:aw@rationalcommerce.com> <aw@rationalcommerce.com <mailto:aw@rationalcommerce.com> >
    Sent: 29 July 2020 08:18
    To: Martin Bowes <martin.bowes@ndph.ox.ac.uk <mailto:martin.bowes@ndph.ox.ac.uk> >; Ingres lists <info-ingres@lists.planetingres.org <mailto:info-ingres@lists.planetingres.org> >
    Subject: Re: [Info-ingres] why is an empty string an integer



    Morning



    If 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 Bowes

    Date: Wed, 29 Jul 2020 08:01

    To: 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


    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta
    http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
    /* Font Definitions */
    @font-face
    {font-family:"Cambria Math";
    panose-1:2 4 5 3 5 4 6 3 2 4;}
    @font-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
    @font-face
    {font-family:"Lucida Console";
    panose-1:2 11 6 9 4 5 4 2 2 4;}
    /* Style Definitions */
    p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0cm;
    margin-bottom:.0001pt;
    font-size:12.0pt;
    font-family:"Times New Roman",serif;}
    a:link, span.MsoHyperlink
    {mso-style-priority:99;
    color:#0563C1;
    text-decoration:underline;}
    span.EmailStyle22
    {mso-style-type:personal-compose;
    font-family:"Calibri",sans-serif;
    color:windowtext;}
    .MsoChpDefault
    {mso-style-type:export-only;
    font-size:10.0pt;}
    @page WordSection1
    {size:612.0pt 792.0pt;
    margin:72.0pt 72.0pt 72.0pt 72.0pt;}
    div.WordSection1
    {page:WordSection1;}
    </style><!--[if gte mso 9]><xml>
    <o:shapedefaults v:ext="edit" spidmax="1026" />
    </xml><![endif]--><!--[if gte mso 9]><xml>
    <o:shapelayout v:ext="edit">
    <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--></head><body lang=EN-GB link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Hi,<o:p></o:p></span></p><p
    class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>My guess
    is blank string is being translated to zero:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;
    font-family:"Lucida Console";mso-fareast-language:EN-US'>* select integer('');\g<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Lucida Console";mso-fareast-language:EN-US'>Executing . . .<o:p></o:p></span></p><p class=
    MsoNormal><span style='font-size:11.0pt;font-family:"Lucida Console";mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Lucida Console";mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span>
    </p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Lucida Console";mso-fareast-language:EN-US'>+-------------+<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Lucida Console";mso-fareast-language:EN-US'>|
    col1Β Β Β Β Β Β Β Β  |<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Lucida Console";mso-fareast-language:EN-US'>+-------------+<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"
    Lucida Console";mso-fareast-language:EN-US'>|Β Β Β Β Β Β Β Β Β Β Β  0|<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Lucida Console";mso-fareast-language:EN-US'>+-------------+<o:p></o:p></span></p><p class=MsoNormal><
    span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Ingres 10.1 did not want
    to play with these new predicates, and my Ingres 11 did as yours.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span
    style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>OpenROAD gave up here:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:
    </span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:
    EN-US'>insert into fred values (null), (''), ('1'), ('13-jan-2020');<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β
     Β  ^<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>%% Error at line 11<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-
    serif;mso-fareast-language:EN-US'>E_W400F0 Syntax error.Β  The last symbol read was ','.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p
    class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Go figure.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&
    nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>That’s why I don’t look at new SQL features – no point.<o:p></o:p></span></p><p class=MsoNormal><span style='font-
    size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Cheers<o:p></o:p></span></p><p class=
    MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'>Adrian<o:p></o:
    </span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=
    MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Martin Bowes &lt;martin.bowes@ndph.ox.ac.uk&gt; <br><b>Sent:</b> 29 July
    2020 08:25<br><b>To:</b> aw@rationalcommerce.com; Ingres lists &lt;info-ingres@lists.planetingres.org&gt;<br><b>Subject:</b> RE: [Info-ingres] why is an empty string an integer<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p
    class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Hi Adrian,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-
    fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Yes zero works fine.<o:p></o:p></span></p><p class=MsoNormal><span style='font-
    size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>The syntax is
    referred to as β€˜predicates’ and there are a whole host of them to do basic tests. I have found them extremely useful in doing data imports from less than reliable third parties.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;
    font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Marty<o:p></o:p></span></p><
    p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=
    MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> <a href="mailto:aw@rationalcommerce.com">aw@rationalcommerce.com</a> &lt;<
    a href="mailto:aw@rationalcommerce.com">aw@rationalcommerce.com</a>&gt; <br><b>Sent:</b> 29 July 2020 08:18<br><b>To:</b> Martin Bowes &lt;<a href="mailto:martin.bowes@ndph.ox.ac.uk">martin.bowes@ndph.ox.ac.uk</a>&gt;; Ingres lists &lt;<a href="mailto:
    info-ingres@lists.planetingres.org">info-ingres@lists.planetingres.org</a>&gt;<br><b>Subject:</b> Re: [Info-ingres] why is an empty string an integer<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><div><p class=MsoNormal><
    span style='font-size:10.0pt'>Morning<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'>If you use zero instead of 1 do you get the
    same?<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'>I must admit i have not seen that 'when a is integer/float' syntax before.<o:
    </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'>But then i use openroad so our syntax is about 20 years behind.<o:p></o:p></span></p><
    /div><div><p class=MsoNormal><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'>Adrian<o:p></o:p></span></p></div></div><div><div id=LGEmailHeader><div><p class=MsoNormal><span style='
    font-size:10.0pt'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'>------ Original message------<o:p></o:p></span></p></div><div><p class=MsoNormal><b><span style='font-size:10.0pt'>From: </span></b><span style='
    font-size:10.0pt'>Martin Bowes<o:p></o:p></span></p></div><div><p class=MsoNormal><b><span style='font-size:10.0pt'>Date: </span></b><span style='font-size:10.0pt'>Wed, 29 Jul 2020 08:01<o:p></o:p></span></p></div><div><p class=MsoNormal><b><span style='
    font-size:10.0pt'>To: </span></b><span style='font-size:10.0pt'>Ingres lists;<o:p></o:p></span></p></div><div><p class=MsoNormal><b><span style='font-size:10.0pt'>Cc: </span></b><span style='font-size:10.0pt'><o:p></o:p></span></p></div><div><p class=
    MsoNormal><b><span style='font-size:10.0pt'>Subject:</span></b><span style='font-size:10.0pt'>[Info-ingres] why is an empty string an integer<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></p></
    </div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt'>Hi All,<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-
    size:10.0pt'>&nbsp;<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt'>I may have come across this before, but it’s early and I haven’t had my coffee.<o:p></o:p></span></p>
    <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt'>&nbsp;<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-
    size:10.0pt;font-family:"Lucida Console"'>declare global temporary table fred(</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-
    size:10.0pt;font-family:"Lucida Console"'>&nbsp;&nbsp;&nbsp; a varchar(20)</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:
    10.0pt;font-family:"Lucida Console"'>) on commit preserve rows with norecovery;</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-
    size:10.0pt;font-family:"Lucida Console"'>Executing . . .</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-
    family:"Lucida Console"'>&nbsp;</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>
    continue</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>* * insert into fred values (
    null), (''), ('1'), ('13-jan-2020');</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>
    Executing . . .</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>&nbsp;</span><span
    style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>(4 rows)</span><span style='font-size:10.0pt'><o:
    </o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>continue</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=
    MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>* * * * * * * * select case when a is null then 'null'</span><span style='font-size:10.0pt'><o:p></o:p></
    span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when a = '' then '
    empty string'</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else a end as data,</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-
    family:"Lucida Console"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is integer then 'integer' else 'not integer' end as is_integer,</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-
    margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case when a is float then 'float' else 'not float' end as is_float,</span><span style='font-size:10.0pt'><o:p></o:
    </span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is ansidate then 'ansidate' else '
    not ansidate' end as is_ansidate</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>from
    fred;</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>Executing . . .</span><span
    style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>&nbsp;</span><span style='font-size:10.0pt'><o:p><
    /o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>&nbsp;</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=
    MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β
    ”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;
    font-family:"Lucida Console"'>β”‚data&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;β”‚is_integer β”‚is_float β”‚is_ansidate β”‚</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal
    style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”
    €β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:
    "Lucida Console"'>β”‚null&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; β”‚not integerβ”‚not floatβ”‚not ansidateβ”‚</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-
    margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>β”‚empty string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; β”‚<span style='background:yellow;mso-highlight:yellow'>integer&nbsp;
    &nbsp;&nbsp; β”‚float</span>&nbsp;&nbsp;&nbsp; β”‚not ansidateβ”‚</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;
    font-family:"Lucida Console"'>β”‚1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; β”‚integer&nbsp;&nbsp;&nbsp; β”‚float&nbsp;&nbsp;&nbsp; β”‚not ansidateβ”‚</span><span style='font-size:10.0pt'>
    <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>β”‚13-jan-2020&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; β”‚not
    integerβ”‚not floatβ”‚ansidate&nbsp;&nbsp;&nbsp; β”‚</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"
    Lucida Console"'>β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p
    class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>(4 rows)</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-
    margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:10.0pt;font-family:"Lucida Console"'>continue</span><span style='font-size:10.0pt'><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-
    margin-bottom-alt:auto'><span style='font-size:10.0pt'>&nbsp;<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt'>Now the tests with nulls behave as I expect. But the empty
    string cases I did not expect. Is this a bug? Documented behaviour?<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt'>&nbsp;<o:p></o:p></span></p><p class=MsoNormal style='
    mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt'>Martin Bowes<o:p></o:p></span></p></div></div></div></div></body></html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul White@21:1/5 to Martin Bowes on Wed Jul 29 18:56:06 2020
    Copy: info-ingres@lists.planetingres.org (Ingres lists)

    Hi Marty,

    I expect the result of "a is integer" should align to the result of
    int(a).

    Compare with MSSQL with some doubtful results.

    create table #fred(
    a varchar(20));

    insert into #fred values (null), (''), ('1'), ('1.0'), ('13-jan-2020');

    select case when a is null then 'null'
    when a = '' then 'empty string'
    else a end as data,
    case when try_convert(numeric,a) is null then '' else 'Y' end as Is_Num,
    case when try_convert(int,a) is null then '' else 'Y' end as is_int,
    case when try_convert(float,a) is null then '' else 'Y' end as is_float,
    case when try_convert(money,a) is null then '' else 'Y' end as Is_money,
    case when try_convert(datetime,a) is null then '' else 'Y' end as is_date
    from #fred;

    data Is_Num is_int is_float Is_money is_date -------------------- ------ ------ -------- -------- -------
    null
    empty string Y Y Y Y
    1 Y Y Y Y
    1.0 Y Y Y
    13-jan-2020 Y

    (5 rows affected)

    Paul White
    &

    <div dir="ltr"><div dir="ltr">Hi Marty,<div><br></div><div>I expect the result of &quot;a is integer&quot; should align to the result of int(a).Β Β </div><div><br></div><div>Compare with MSSQL with some doubtful results.</div><div><br>create table #fred(<
    Β  Β a varchar(20));<br><br>insert into #fred values (null), (&#39;&#39;), (&#39;1&#39;), (&#39;1.0&#39;), (&#39;13-jan-2020&#39;);<br><br>select case when a is null then &#39;null&#39;<br>Β  Β  Β  Β  Β  Β  when a = &#39;&#39; then &#39;empty string&#
    39;<br>Β  Β  Β  Β  Β  Β  else a end as data,<br>Β  case when try_convert(numeric,a) is null then &#39;&#39; else &#39;Y&#39; end as Is_Num,<br> Β  case when try_convert(int,a) is null then &#39;&#39; else &#39;Y&#39; end Β as is_int,<br> Β  case when
    try_convert(float,a) is null then &#39;&#39; else &#39;Y&#39; end Β as is_float,<br>Β  case when try_convert(money,a) is null then &#39;&#39; else &#39;Y&#39; end Β as Is_money,<br> Β  case when try_convert(datetime,a) is null then &#39;&#39; else &#39;
    Y&#39; end Β as is_date<br> Β  from #fred;<br><br></div><div>data Β  Β  Β  Β  Β  Β  Β  Β  Is_Num is_int is_float Is_money is_date<br>-------------------- ------ ------ -------- -------- -------<br>null Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β
      Β  Β  Β  Β  Β  Β  Β <br>empty stringΒ  Β  Β  Β  Β  Β  Β  Β  Y Β  Β  Β Y Β  Β  Β  Β Y Β  Β  Β  Β Y<br>1 Β  Β  Β  Β  Β  Β  Β  Β  Β  Β YΒ  Β  Β  Y Β  Β  Β Y Β  Β  Β  Β Y Β  Β  Β  Β <br>1.0 Β  Β  Β  Β  Β  Β  Β  Β  Β YΒ  Β  Β  Β  Β  Β  Β Y Β  Β  Β  Β Y Β  Β 
    Β  Β <br>13-jan-2020Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Y<br></div><div><br></div><div>(5 rows affected)</div><div><br></div><div><span style="font-family:arial">Paul White</span><br></div></div><div dir="ltr" class="gmail_
    signature"><div dir="ltr"><div><div dir="ltr">&amp;</div></div><div dir="ltr"><br></div></div></div></div>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roy Hann@21:1/5 to Martin Bowes on Wed Jul 29 09:01:00 2020
    Martin Bowes wrote:

    Is this a bug? Documented behaviour?

    I don't recall seeing it documented. I don't think it is a bug though.
    It might be mis-feature but it would appear to be forced on us. If you
    think of "is integer" meaning "is this a value which Ingres will treat
    as an integer", Ingres has always treated '' as zero except in the
    special case

    SELECT ''

    which does return an empty string.

    Otherwise all these return numbers of one sort or another:

    SELECT 1+'';
    SELECT 1*'';
    SELECT cos('');
    SELECT 0**'';

    And this gives the predictable error:

    SELECT 1/'';

    Roy

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)