Perhaps not quite correct handling of DDL errors

17 views
Skip to first unread message

Dimitry Sibiryakov

unread,
Mar 18, 2026, 1:14:36 PMMar 18
to firebir...@googlegroups.com
Hello All,

following testcase is completely artificial just to show what may be
considered as a problem:

Apply following patch to force generate an error during table creation:

diff --git a/src/dsql/DdlNodes.epp b/src/dsql/DdlNodes.epp
index d66aeed2d5..5d0d1a7b42 100644
--- a/src/dsql/DdlNodes.epp
+++ b/src/dsql/DdlNodes.epp
@@ -12522,7 +12522,7 @@ MetaId StoreIndexNode::create(thread_db* tdbb,
Cached::Relation* rel, jrd_tra* t
partner_relation =
MetadataCache::getPerm<Cached::Relation>(tdbb, idx.idx_primary_relation,
CacheFlag::AUTOCREATE);
}

- if (!partner_relation)
+ if (!partner_relation || indexName.object == "FAIL_THIS")
{
MetaName constraint_name;
MET_lookup_cnstrt_for_index(tdbb, constraint_name,
indexName);

Then execute following SQL command:

RECREATE TABLE test_constraints(
id integer not null constraint pk_c primary key,
unq_a integer constraint uk_a unique,
unq_b integer constraint uk_b unique,
fk_a integer constraint fk_a references test_constraints (id),
fk_b integer constraint fk_b references test_constraints (id),
fk_c integer constraint fail_this references test_constraints (id));

You will get a strange bugcheck:

Database: TEST
Cannot create foreign key constraint FAIL_THIS. Partner index does not exist or
is inactive.
Cannot delete index segment used by an Integrity Constraint
internal Firebird consistency check (record disappeared (186), file:
Savepoint.cpp line: 272)


--
WBR, SD.

Reply all
Reply to author
Forward
0 new messages