From 11dec10f9fc079ed74d623211e01f465e45d6a7c Mon Sep 17 00:00:00 2001 From: Dimitry Sibiryakov Date: Mon, 22 Jan 2024 15:41:36 +0100 Subject: [PATCH] Fix both parts of #7924 (#7940) * Fix both parts of #7924 * STL-compatible empty() method used * Get back to isEmpty() --- src/dsql/DdlNodes.epp | 12 ++++++++++++ src/dsql/ddl.cpp | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/dsql/DdlNodes.epp b/src/dsql/DdlNodes.epp index 0b3a4a67b3..e508f97ff1 100644 --- a/src/dsql/DdlNodes.epp +++ b/src/dsql/DdlNodes.epp @@ -8339,6 +8339,18 @@ void AlterRelationNode::modifyField(thread_db* tdbb, DsqlCompilerScratch* dsqlSc FLD.RDB$SEGMENT_LENGTH.NULL, FLD.RDB$SEGMENT_LENGTH); END_MODIFY + MODIFY RFR USING + if (field->explicitCollation) + { + RFR.RDB$COLLATION_ID.NULL = FALSE; + RFR.RDB$COLLATION_ID = field->collationId; + } + else + { + RFR.RDB$COLLATION_ID.NULL = TRUE; // CORE-2426 and Issue #7924 + } + END_MODIFY + newDom.dyn_fld_source = origDom.dyn_fld_source; } else // Case b2: Domain -> internal domain. diff --git a/src/dsql/ddl.cpp b/src/dsql/ddl.cpp index d65d639789..761a13913b 100644 --- a/src/dsql/ddl.cpp +++ b/src/dsql/ddl.cpp @@ -276,8 +276,9 @@ void DDL_resolve_intl_type(DsqlCompilerScratch* dsqlScratch, dsql_fld* field, return; } - if (modifying) + if (modifying && field->charSet.isEmpty() && field->collate.isEmpty()) { + // Use charset and collation from already existing field if any const dsql_fld* afield = field->fld_next; USHORT bpc = 0; @@ -310,10 +311,10 @@ void DDL_resolve_intl_type(DsqlCompilerScratch* dsqlScratch, dsql_fld* field, } } - if (!(field->charSet.hasData() || field->charSetId.has_value() || // set if a domain + if (!modifying && !(field->charSet.hasData() || field->charSetId.has_value() || // set if a domain (field->flags & FLD_national))) { - // Attach the database default character set, if not otherwise specified + // Attach the database default character set to the new field, if not otherwise specified MetaName defaultCharSet;