Hi, I think current behaviour of ALTER DOMAIN regarding CHARACTER SET is correct.
CHARACTER SET is part of the datatype clause. So omitting CHARACTER SET means the default character set has te bo taken. If you want to keep the current (non-default) character set, you have to repeat it in the ALTER DOMAIN statement. So, if ISO8859_1 is the default character set: CREATE DOMAIN MyDomain VARCHAR(10) CHARACTER SET UTF8 /* set character set to UTF8 */ ALTER DOMAIN MyDomain TYPE VARCHAR(20) CHARACTER SET UTF8 /* keeps character set UTF8 */ ALTER DOMAIN MyDomain TYPE VARCHAR(30) /* change character set to default character set, in this case ISO8859_1 */ BTW, COLLATE is another story, this is *not* part of the datatype clause (like DEFAULT and NOT NULL). I think Firebird (2.5/3.0) is not working correctly in this case (see second statement below). If ISO8859_1 is the default character set and ISO8859_1 is the default collation for character set ISO8859_1: CREATE DOMAIN MyDomain VARCHAR(10) CHARACTER SET ISO8859_1 COLLATE DU_NL /* set collation to DU_NL */ ALTER DOMAIN MyDomain TYPE VARCHAR(20) CHARACTER SET ISO8859_1 /* should keep collation DU_NL, however Firebird will reset this to default collation ISO8859_1 */ ALTER DOMAIN MyDomain TYPE VARCHAR(30) /* set character set to default character set, which is also ISO8859_1, but reset collation to default collation ISO8859_1 */ Kind regards, Robert -----Oorspronkelijk bericht----- From: Adriano dos Santos Fernandes Sent: Thursday, September 12, 2013 5:25 PM To: For discussion among Firebird Developers Subject: [Firebird-devel] ALTER type and CHARACTER SET Hi! Debugging CORE-4213, I found that ALTER DOMAIN uses the default database charset. -- Database default charset is WIN1252. -- OK: Domain is created with WIN1252. create domain d as varchar(10); -- OK: Charset of domain is changed. alter domain d type varchar(10) character set utf8; -- Not OK: Charset of domain is changed to WIN1252 (NONE if there is no default charset) alter domain d type varchar(10); IMO, this is error prone. When one is altering the column length, it's easy to miss the charset and change it without knowing. Comments? Adriano ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel