You can use a replication definition to specify tables that have referential contraints, such as a foreign key and other check constraints, so that HVAR is aware of these tables. See “HVAR processing and limitations”.
Usually the referencing table contains referential constraints for a referenced table within the same primary database. However, HVAR extends referential constraints support to referenced tables from multiple primary databases. You can specify the referencing table in replication definition for each primary database. However, if multiple referential constraints conflict with each other, Replication Server picks up one referential constraint at random.
Use the create replication definition commands with the references clause to specify the table with referential constraints.
create replication definition ... (column_name [as replicate_column_name] ... [map to published_datatype]] [quoted] [references [table_owner.]table_name [(column_name)]] …) ....]
Use the alter replication definition command with the references clause to add or change a referencing table. Use the null option to drop a reference.
alter replication definition ..... add column_name [as replicate_column_name] [map to published_datatype] [quoted] [references [table_owner.]table_name [(column_name)] ... | alter columns with column_name references {[table_owner.]table_name [(column_name)] | NULL} [, column_name references {[table_owner.]table_name [(column_name)] | NULL} ...
For both alter replication definition and create replication definition with the reference clause, Replication Server:
Treats the reference clause as a column property. Each column can reference only one table.
Does not process the column name you provide in the column_name parameter within the reference clause.
Does not allow referential constraints with cyclical references. For example, the original referenced table cannot have a referential constraint to the original referencing table.
During replication processing, HVAR loads:
Inserts to the referenced tables before the referencing table you specify in the replication definition.
Deletes to the referenced tables after the table you specify in the replication definition.
In some cases, updates to both tables fail because of conflicts. To prevent HVAR from retrying replication processing, and thus decreasing performance, you can:
Stop replication updates by setting dsi_command_convert to “u2di,” which converts updates to deletes and inserts.
Turn off dsi_compile_enable to avoid compiling the affected tables.
HVAR cannot compile and thus marks out tables with customized function-strings, and tables that have referential constraints to an existing table that it cannot compile. By marking out these tables, HVAR optimizes replication processing by avoiding transaction retries due to referential constraint errors.