Tables with referential constraints

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.


Creating and altering replication definitions

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:

During replication processing, HVAR loads:

In some cases, updates to both tables fail because of conflicts. To prevent HVAR from retrying replication processing, and thus decreasing performance, you can:

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.