Column Defaults and Column Constraints

From InterBase

Go Up to Method One: In-place Migration


The steps on the parent page permitted you to retain double quoted string constants in column defaults, column constraints, and unnamed table constraints. This is possible because, once created, InterBase stores them in binary form.

Following the steps above creates a dialect 3 database that is fully functional, but if it contains double quoted string constants in column defaults, column constraints, or unnamed column constraints, inconsistencies are visible when you SHOW metadata or extract it. You can choose to resolve these inconsistencies by following these steps:

  1. Back up the database.
  2. Examine the metadata to detect each occurrence of a column default or column constraint that uses double quotes.
  3. For each affected column, use the ALTER COLUMN clause of the ALTER TABLE statement to give the column a temporary name. If column position is likely to be an issue with any of your clients, change the position as well.
  4. Create a new column with the desired data type, giving it the original column name and position.
  5. Use UPDATE to copy the data from old column to the new column:
    UPDATE table_name
     SET new_col = old_col;
    
  6. Drop the old column.

Advance To: