Executes a script containing arbitrary SQL statements on all nodes that are subscribed to a set at a common controlled point within the replication transaction stream.
The specified event origin must be the origin of the set.
The script file must not contain any START or
COMMIT TRANSACTION calls. (This may change in
PostgreSQL 8.0 once nested transactions, aka savepoints, are
supported) In addition, non-deterministic DML statements (like
updating a field with CURRENT_TIMESTAMP
) must
be avoided, since the data changes done by the script are
explicitly not replicated.
The unique numeric ID number of the set affected by the script
The name of the file containing the SQL script to execute. This might be a relative path, relative to the location of the slonik instance you are running, or, preferably, an absolute path on the system where slonik is to run.
The contents of the file are propagated as part of the event, so the file does not need to be accessible on any of the nodes.
(Optional) The ID of the current origin of the set. Default value is 1.
(Optional) The ID of the only node to actually execute the script. This option causes the script to be propagated by all nodes but executed only by one. The default is to execute the script on all nodes that are subscribed to the set.
See also the warnings in .
Note that this is a locking operation, which means that it can get stuck behind other database activity.
At the start of this event, all tables in the specified set
are unlocked via the function
alterTableRestore(tab_id)
. After the SQL
script has run, they are returned to "replicating
state" using
alterTableForReplication(tab_id)
. This means
that all of these tables are locked by this slon
process for the duration of the SQL script
execution.
If a table's columns are modified, it is very important that the triggers be regenerated, otherwise they may be inappropriate for the new form of the table schema.