• [Info-ingres] convtohyb ... is it just me?

    From Martin Bowes@21:1/5 to All on Wed May 19 08:12:32 2021
    Hi All,

    I have a test table:
    create table test_conv(
    id integer4 not null not default,
    a integer4 not null with default,
    b float4 not null with default,
    tinsert ingresdate not null with default 'now',
    tupdate ingresdate not null with default ''
    ) with nojournaling;

    insert into test_conv(id, a, tinsert, tupdate) values
    (1, 11, '1-jan-1970', '11-jan-1970 11:12:31'),
    (2, 12, '2-dec-1985', '12-jan-1986 12:12:12'),
    (3, 13, '3-feb-2020', '5-mar-2021 12:45:56');

    modify test_conv to btree unique on id with unique_scope=statement;

    create unique index test_conv_a on test_conv(a) with unique_scope=statement;

    create index test_conv_b on test_conv(b);

    And then run: convtohyb -to_ansi iidbdb test_conv

    Now given the data I would expect my tinsert to become ansidate and tupdate to become timestamp(0) without time zone.

    And examining the generated conversion script ctohout.sql that is indeed what I get...sort of:
    drop index if exists test_conv_a
    \p\g
    drop index if exists test_conv_b
    \p\g
    alter table ingres.test_conv alter column tinsert ansidate not null default CURRENT_TIMESTAMP
    \p\g
    alter table ingres.test_conv alter column tupdate timestamp(0) without time zone not null default NULL
    \p\g
    modify test_conv to btree unique on
    id
    with nonleaffill = 80,
    leaffill = 70,
    fillfactor = 80,
    extend = 16,
    page_size = 8192,
    unique_scope = statement
    \p\g

    /* INDEXES */
    create index (test_conv_a on test_conv (
    a) unique
    with structure = isam,
    page_size = 8192,
    nocompression,
    key = (a),
    unique_scope = statement,
    fillfactor = 80,
    location = (ii_database)),
    (test_conv_b on test_conv (
    b)
    with structure = isam,
    page_size = 8192,
    nocompression,
    key = (b),
    fillfactor = 80,
    location = (ii_database))
    \p\g

    The problem being that the two alter statements don't work and the less said about that attempt to recreate indexes the better!

    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=us-ascii">
    <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 have a test table:<o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">create table test_conv(<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; id integer4 not null not default,<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&nbsp; integer4 not null with default,<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; b&nbsp; float4&nbsp;&nbsp; not null with default,<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; tinsert ingresdate not null with default 'now',<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; tupdate ingresdate not null with default ''<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;">) with nojournaling;<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;">insert into test_conv(id, a, tinsert, tupdate) values<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; (1, 11, '1-jan-1970', '11-jan-1970 11:12:31'),<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; (2, 12, '2-dec-1985', '12-jan-1986 12:12:12'),<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; (3, 13, '3-feb-2020', '5-mar-2021 12:45:56');<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;">modify test_conv to btree unique on id with unique_scope=statement;<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;">create unique index test_conv_a on test_conv(a) with unique_scope=statement;<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;">create index test_conv_b on test_conv(b);<o:p></o:p></span></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">And then run: convtohyb &#8211;to_ansi iidbdb test_conv<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Now given the data I would expect my tinsert to become ansidate and tupdate to become timestamp(0) without time zone.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">And examining the generated conversion script ctohout.sql that is indeed what I get&#8230;sort of:<o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">drop index if exists test_conv_a<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;">\p\g<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;">drop index if exists test_conv_b<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;">\p\g<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;">alter table ingres.test_conv alter column tinsert ansidate not null default CURRENT_TIMESTAMP<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;">\p\g<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;">alter table ingres.test_conv alter column tupdate timestamp(0) without time zone not null default 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;">\p\g<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;">modify test_conv to btree unique on<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; id<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;">with nonleaffill = 80,<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; leaffill = 70,<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; fillfactor = 80,<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; extend = 16,<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; page_size = 8192,<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; unique_scope = statement<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;">\p\g<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;">&nbsp;&nbsp;&nbsp; /* INDEXES */<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;">create index (test_conv_a on test_conv (<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) unique<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;">with structure = isam,<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; page_size = 8192,<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; nocompression,<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; key = (a),<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; unique_scope = statement,<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; fillfactor = 80,<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; location = (ii_database)),<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;">(test_conv_b on test_conv (<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; b)<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;">with structure = isam,<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; page_size = 8192,<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; nocompression,<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; key = (b),<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; fillfactor = 80,<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; location = (ii_database))<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;">\p\g<o:p></o:p></span></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">The problem being that the two alter statements don&#8217;t work and the less said about that attempt to recreate indexes the better!<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Martin Bowes<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    </div>
    </body>
    </html>

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