Informix

Informix

Connect with Db2, Informix, Netezza, open source, and other data experts to gain value from your data, share insights, and solve problems.

 View Only
  • 1.  Problem add BSON column in a table

    Posted 2 days ago

    Hi,

    I have a syntax error when trying to alter a table to add a bson column to a sbspace.

    If I create the table with the bson column everything work.

    Example: 
    drop table if exists "prog".jgc;
    create table "prog".jgc
      (
        jgc_seq bigserial not null ,
        jgc_sdbo1_seq bigint not null ,
        jgc_tabname varchar(128) not null ,
        jgc_tab_seq bigint not null ,
        jgc_type char(1) not null ,
        jgc_rec_date datetime year to second
            default current year to second,
        jgc_data "informix".bson
      ) put jgc_data in ( sbspace1_sbs )
      extent size 1000 next size 1000 lock mode row;

    But if I alter and existing table I have a syntax error

    drop table if exists "prog".jgc;
    create table "prog".jgc
      (
        jgc_seq bigserial not null ,
        jgc_sdbo1_seq bigint not null ,
        jgc_tabname varchar(128) not null ,
        jgc_tab_seq bigint not null ,
        jgc_type char(1) not null ,
        jgc_rec_date datetime year to second
            default current year to second
      )
      extent size 1000 next size 1000 lock mode row;
     
    alter table "prog".jgc
      add (
        jgc_data "informix".bson
      ) put jgc_data in ( sbspace1_sbs )
    ;

    Database selected.
    Table dropped.
    Table created.
     
      201: A syntax error has occurred.
    Error in line 17
    Near character position 4
     
    Database closed.

    What's I'm doing wrong ?

     dbaccess -version
    Program Name:           dbaccess
    Build Version:          14.10.FC10WE
    Build Number:           N164
    Build Host:             njdc-lxibm01
    Build OS:               Linux 3.10.0-693.el7.x86_64
    Build Date:             Tue Mar 7 18:17:20 CST 2023
    Build Timestamp:        2023-03-07T16:45:54-06
    GLS Version:            glslib-7.00.FC7

    Best Regards,







    ------------------------------
    Jean-Guy Charron
    ------------------------------


  • 2.  RE: Problem add BSON column in a table

    Posted 2 days ago

    Ok I found the solution.

    I need to add the column first and do another alter for the put clause.


    alter table "prog".jgc  add (  jgc_data "informix".bson  );
    alter table "prog".jgc put jgc_data in ( sbspace1_sbs );

    It's a bit strange the we can't to it at once.



    ------------------------------
    Jean-Guy Charron
    ------------------------------



  • 3.  RE: Problem add BSON column in a table

    Posted 2 days ago

    Ha - I was just about to suggest the same thing!

    I see the same behavior that the PUT throws a syntax error if it is included along with the ADD of the new column.  But executing it as 2 distinct alter statements (ADD and PUT), then it seems to work.

    Weird though as this syntax should be acceptable according to the documentation.



    ------------------------------
    Mike Walker
    xDB Systems, Inc
    www.xdbsystems.com
    ------------------------------