----------  Alter Table  ----------

The structure of a table may be changed using the "alter table"  command.  You
may  add  new attributes, change the data types of existing attributes, delete
unwanted attributes, add checksum, delete checksum, or move the table to a  new
directory. 

If there is any trigger on the table, the "alter table" command can be used 
to enable/disable trigger, or change the priority of trigger(s).

If there is any replication master entry on the replicate table, the "alter
table" command can be used to enable/disable, or change the order of 
replication entry/entries.

You also can use "alter" command to change table type between normal table and 
master table.

There  are  eight forms of the command:

Syntax 1:

     alter [table] TABLE ACTION { [:] ACTION };

ACTION can be a combination of: 

          | add ITEM {,ITEM} [before ATTR_NAME] |
          | change ITEM2 {, ITEM2}              |
          | delete ITEM {, ITEM}                |
          | add    [|   record   |] checksum    |
          |         |   longvar  |              |
          | delete [|   record   |] checksum    |
          |         |   longvar  |              |


ITEM is:  ATTR_NAME DATATYPE [(PARAMETER {, PARAMETER})]
                    [[not] null] [[not] encrypted]

ITEM2 is: ATTR_NAME [DATATYPE [(PARAMETER {, PARAMETER})]]
                    [[not] null] [[not] encrypted]

Syntax 2:

     alter [table] TABLE CONSTRAINT_ACTION { [:] CONSTRAINT_ACTION };

CONSTRAINT_ACTION can be a combination of: 

          | add    CONSTRAINT1                  |
          | delete CONSTRAINT2                  |


CONSTRAINT1 is one of:

     a) primary key [KEY_NAME] [on] (ATTR_NAME {, ATTR_NAME})

                [| btree      |]
                 | timeseries |

     b) constraint CONSTRAINT_ID primary key (ATTR_NAME {, ATTR_NAME}) 

                [| btree      |]
                 | timeseries |

     c) foreign key [KEY_NAME] [on] (ATTR_NAME {, ATTR_NAME})

                [| distinct                  |  | btree      |]
                 | unique                    |  | timeseries |
                 | [(]PRIMARY[,] OVERFLOW[)] |
                 | not index                                 |

                references TABLE (ATTR_NAME {, ATTR_NAME})

     d) constraint CONSTRAINT_ID foreign key (ATTR_NAME {, ATTR_NAME}) 

                [| distinct                  |  | btree      |]
                 | unique                    |  | timeseries |
                 | [(]PRIMARY[,] OVERFLOW[)] |
                 | not index                                 |

                references TABLE (ATTR_NAME {, ATTR_NAME})

     e) unique (ATTR_NAME {, ATTR_NAME} ) [| btree      |]
                                           | timeseries |

     f) constraint CONSTRAINT_ID unique (ATTR_NAME {, ATTR_NAME} )

                [| btree      |]
                 | timeseries |

CONSTRAINT2 is one of:

     a) primary key [KEY_NAME]

     b) foreign key [KEY_NAME] [on] (ATTR_NAME {, ATTR_NAME})

     c) foreign key KEY_NAME

     d) unique [on] ((ATTR_NAME {, ATTR_NAME})

     e) constraint CONSTRAINT_ID

Syntax 3: 

     alter [table] TABLE [locate [in] LOCATION_NAME];

LOCATION_NAME is: an existing valid directory name

If only "alter TABLE;" is specified, the Interactive Interface is invoked  and
begins prompting for the changes.

For further information, enter:

                help rename;
                help ia_alter;
                help datatypes;

Syntax 4:
 
     alter [table] TABLE | enable  | | all triggers                 |;
                         | disable | | trigger TRIGGER {, TRIGGER } |

This command is used to enable/disable trigger(s).

For further information, enter:

                help trigger;

Syntax 5: 

     alter [table] TABLE change trigger TRIGGER {, TRIGGER}
           priority FLOAT;

This command is used to change the priority of trigger(s). The priority
is denoted by FLOAT, the larger the FLOAT is, the higher priority the 
trigger has.

For further information, enter:

                help trigger;

Syntax 6:

     alter [table] REPLICATION_TABLE | enable  | 
                                     | disable |

           | all replication | masters |                            |;
                             | master  |
           | replication master REP_MASTER_INFO {, REP_MASTER_INFO} |

        REP_MASTER_INFO is one of the form: 

        a)  SERVER_NAME:DB_NAME:TABLE_NAME

        b)  SERVER_NAME:DB_NAME..TABLE_NAME

        REPLICATION_TABLE can be master or replicate table.

This command is used to enable/disable replication master entry/entries
of a replicate table.

                help replication;

Syntax 7:

     alter [table] REPLICATION_TABLE change replication master order 
           REP_MASTER_INFO FLOAT {, REP_MASTER_INFO FLOAT};

This command is used to change the order of replication master 
entry/entries. The order is denoted by FLOAT.

                help replication;

Syntax 8: 

     alter [table] TABLE change table type to 
           | master    [table] [for subset on (ATTR_NAME {, ATTR_NAME} )] |;
           | replicate [table]                                            |
           | normal    [table] [with force]                               |


This command is used to change table type among master, normal and 
replicate, the direct conversion from normal to replicate is invalid.

    "for subset on" option can only be applied to convert normal table 
to master table. If no primary key is defined the normal table, the 
conversion will fail.

    "with force" option can only be applied to convert master/replicate 
table to normal table. If it is specified, the corresponding replication 
replicate(s) and replication master(s) are not checked.

For further information, enter:

                help replication;
