Start and stop passthrough mode

Passthrough mode is started using the PASSTHROUGH statement and the PASSTHROUGH STOP statement. A passthrough session refers to the statements entered between the PASSTHROUGH statements. Statements entered in a passthrough session:

  • Are checked for syntax errors.

  • Are executed at the consolidated database unless you supply the ONLY keyword. When ONLY is specified, the statements are sent to the remote database without being executed on the consolidated database.

    The following statement starts a passthrough session, which passes the statements to a list of two named subscribers, without being executed at the current database:

    PASSTHROUGH ONLY
    FOR userid_1, userid_2;
  • Are passed to the identified subscriber database. Passthrough statements are replicated in sequence with normal replication messages, in the order in which the statements are recorded in the transaction log.

  • Are executed at the subscriber database.

Direct passthrough statements

The following statement starts a passthrough session that passes the statements to all users who are subscribed to the pubname publication:

PASSTHROUGH ONLY
FOR SUBSCRIPTION TO [owner].pubname statement1;

Passthrough mode is additive. In the following example, statement_1 is sent to user_1, and statement_2 is sent to both user_1 and user_2.

PASSTHROUGH ONLY FOR user_1 ;
statement_1;
PASSTHROUGH ONLY FOR user_2 ;
statement_2;

The following statement stops a passthrough session for all remote users:

PASSTHROUGH STOP;
Data modification language (DML)

Passthrough mode is commonly used to send data modification statements. In this case, replicated DML statements use the before schema before the passthrough and the after schema following the passthrough.

The following example drops a table on the remote database and the consolidated database.

-- Drop a table on the remote database
-- and at the consolidated database
PASSTHROUGH TO Joe_Remote;
DROP TABLE CrucialData;
PASSTHROUGH STOP;

The following example drops a table on the remote database only.

-- Drop a table on the remote database only
PASSTHROUGH ONLY TO Joe_Remote;
DROP TABLE CrucialData;
PASSTHROUGH STOP;
See also