EPUB | CHM | PDF

TPSQLRestore.Properties.Options

Top Previous Next

Specifies various behavioral properties of the TPSQLRestore.

Syntax:

TRestoreOption = (roDataOnly, roClean, roCreate, roExitOnError,
              roIgnoreVersion, roList, roNoOwner,
              roSchemaOnly, roVerbose, roNoPrivileges,
              roDisableTriggers, roUseSetSessionAuthorization,
              roSingleTransaction, roNoDataForFailedTables,
              roNoTablespaces, doIfExists, doEnableRowSecurity,
              roStrictNames, roNoSubscriptions, roNoPublications);
TRestoreOptions = set of TRestoreOption;
property Options: TRestoreOptions;

Description:

Set Options to include the desired properties for the restore. Options is a set drawn from the following values:

roDataOnly

Restore only the data, not the schema (data definitions).

roClean

Clean (drop) database objects before recreating them. Unless doIfExists is used, this might generate some harmless error messages, if any objects were not present in the destination database.

roIfExists

   Use conditional commands (i.e. add an IF EXISTS clause) when cleaning database objects. This option is not valid unless doClean is also specified.

roCreate

Create the database before restoring into it. (When this option is used, the database named with DBName property is used only to issue the initial CREATE DATABASE command. All data is restored into the database name that appears in the archive.)

roExitOnError

Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.

roIgnoreVersion

A deprecated option that is now ignored.

roList

List the contents of the archive to file with name specified by OutputFileName. The output file of this operation must be used with the ListFile property to restrict and reorder the items that are restored.

roNoOwner

Do not output commands to set ownership of objects to match the original database. By default, TPSQLRestore issues SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With roNoOwner, any user name can be used for the initial connection, and this user will own all the created objects.

roSchemaOnly

Restore only the schema (data definitions), not the data. Sequence values will be reset.

roVerbose

Specifies verbose mode.

roNoPrivileges

Prevent restoration of access privileges (GRANT/REVOKE commands).

roDisableTriggers

This option is only relevant when performing a data-only restore. It instructs TPSQLRestore to execute commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload. Presently, the commands emitted for roDisableTriggers must be done as superuser. So, you should also specify a superuser name with SuperUserName property, or preferably run TPSQLRestore as a PostgreSQL superuser.

roUseSetSessionAuthorization

Output SQL standard SET SESSION AUTHORIZATION commands instead of OWNER TO commands. This makes the dump more standards compatible, but depending on the history of the objects in the dump, may not restore properly.

roSingleTransaction

This option instructs TPSQLRestore to run entire session in a single transaction.

roNoDataForFailedTables

Suppress loading data if table creation failed, because the table already exists. By default, table data objects are restored even if the associated table could not be successfully created (e. g. because it already exists). With this option, such table data is silently ignored. This is useful for dumping and restoring databases with tables which contain auxiliary data for PostgreSQL extensions (e. g. PostGIS).

roNoTablespaces

Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.

roEnableRowSecurity

This option is relevant only when restoring the contents of a table which has row security. By default, TPSQLRestore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs TPSQLRestore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.

  Note that this option currently also requires the dump be in INSERT format, as COPY TO does not support row security.

roStrictNames

Require that each schema (SchemaNames) and table (TableNames) match at least one schema/table in the backup file.

roNoSubscriptions

Do not output commands to restore subscriptions, even if the archive contains them.

roNoPublications

Do not output commands to restore publications, even if the archive contains them.

See also: SuperUserName, ListFile, OutputFileName