Firebird 2.5.2 modifies the blob subtype

Is it possible to change the SUBTYPE BLOB field?

I have a BLOB with SUBTYPE BINARY, I need to change it to SUBTYPE TEXT, because I get some weird characters in BLOB and in BLOB with SUBTYPE TEXT. I do not have this problem.

+6
source share
1 answer

It is not possible to directly change the subtype of the blob column (attempts to do so will give the error "Cannot change the data type for the BLOBCOLUMN column. Changing the data type is not supported for BLOB or ARRAY columns.")

You need

  • Add a new column with an explicit character set (I assume windows 1252 are based on your comments)

    ALTER TABLE table_name ADD blobcolumn_new BLOB SUB_TYPE TEXT CHARACTER SET WIN1252 
  • Copy data from the old column to the new column:

     UPDATE table_name SET blobcolumn_new = blobcolumn 
  • Discard the old column

     ALTER TABLE table_name DROP blobcolumn 
  • Rename the new column.

     ALTER TABLE table_name ALTER COLUMN blobcolumn_new TO blobcolumn 
+7
source

Source: https://habr.com/ru/post/972436/


All Articles