Fork me on GitHub

This page in other versions: Latest (8.13) | 8.12 | 8.11 | 7.8 | 6.21 | Development

This document in other formats: PDF | ePub | Tarball

Navigation

Subscription Dialog

Use the Subscription dialog to create a subscription. A subscription defines the connection to another database and set of publications (one or more) to which it wants to subscribe.

The subscription dialog organizes the development of a subscription through the following dialog tabs: General, Connection, SSL and With. The SQL tab displays the SQL code generated by dialog selections.

Subscription dialog general tab

Use the fields in the General tab to identify the subscription:

  • Use the Name field to add a descriptive name for the subscription. The name will be displayed in the pgAdmin tree control.

  • The Owner field takes the name of the user automatically as current connected user. You can change the owner after creating subscription using alter subscription. Please note that owner of the subscription has superuser privileges.

Click the Connection tab to continue.

Subscription dialog connection tab

Use the Connection tab to define the connection string to the publisher:

  • Use the Host name/address field to provide the valid hostname or ip address of the publication.

  • Use the Port field to provide port number to connect at Postgres Server in which publication is residing.

  • Use the Username field to provide the name of the user to connect to the publication.

  • Use the Password to provide the password of the user.

  • Use the Database field to connect to the database in which publication is residing.

  • Use the Connection timeout field to specify the maximum wait for connection, in seconds. Zero or not specified means wait indefinetly. It is not recommended to use a timeout of less than 2 seconds.

  • Use the Passfile field to specify the location of a password file (.pgpass). A .pgpass file allows a user to login without providing a password when they connect. For more information, see Section 33.15 of the Postgres documentation.

  • Use the Publication field to specify the publication name on the publishers to subscribe to. Click on the refresh button at the end to load the names of the existing publications and then select from the list. You can also write the name of the known publication in the field.

Click the SSL tab to continue.

Subscription dialog ssl tab

Use the fields in the SSL tab to configure SSL:

If pgAdmin is installed in Server mode (the default mode), you can use the platform-specific File manager dialog to upload files that support SSL encryption to the server. To access the File manager dialog, click the icon that is located to the right of each of the following fields.

  • Use the Client certificate field to specify the file containing the client SSL certificate. This file will replace the default ~/.postgresql/postgresql.crt if pgAdmin is installed in Desktop mode, and <STORAGE_DIR>/<USERNAME>/.postgresql/postgresql.crt if pgAdmin is installed in Web mode. This parameter is ignored if an SSL connection is not made.

  • Use the Client certificate key field to specify the file containing the secret key used for the client certificate. This file will replace the default ~/.postgresql/postgresql.key if pgAdmin is installed in Desktop mode, and <STORAGE_DIR>/<USERNAME>/.postgresql/postgresql.key if pgAdmin is installed in Web mode. This parameter is ignored if an SSL connection is not made.

  • Use the Root certificate field to specify the file containing the SSL certificate authority. This file will replace the default ~/.postgresql/root.crt. This parameter is ignored if an SSL connection is not made.

  • Use the Certificate revocation list field to specify the file containing the SSL certificate revocation list. This list will replace the default list, found in ~/.postgresql/root.crl. This parameter is ignored if an SSL connection is not made.

  • When SSL compression? is set to True, data sent over SSL connections will be compressed. The default value is False (compression is disabled). This parameter is ignored if an SSL connection is not made.

Warning

In Server mode, certificates, private keys, and the revocation list are stored in the per-user file storage area on the server, which is owned by the user account under which the pgAdmin server process is run. This means that administrators of the server may be able to access those files; appropriate caution should be taken before choosing to use this feature.

Click the With tab to continue.

Subscription dialog with tab Subscription dialog with tab

Use the With tab to define some parameters for a subscription:

  • The Copy data? switch specifies whether the existing data in the publications that are being subscribed to should be copied once the replication starts. By default it is set to Yes.

  • The Create slot? switch specifies whether the command should create the replication slot on the publisher. By default it is set to Yes. Please note: if your publisher and subscriber both are inside same PostgreSQL server then is is set to No by default.

  • The Enabled? switch specifies whether the subscription should be actively replicating, or whether it should be just setup but not started yet. By default it is set to Yes.

  • The Connect? specifies whether the CREATE SUBSCRIPTION should connect to the publisher at all. By default, it is set to Yes. Setting this to No will change default values of enabled, create_slot and copy_data to No.

  • Use the Slot Name field to specify the name of the replication slot to use. By default, it uses the name of the subscription for the slot name.

  • Use the Synchronous commit field to override the synchronous_commit setting. By default, it is set to off. It is safe to use off for logical replication: If the subscriber loses transactions because of missing synchronization, the data will be sent again from the publisher.

  • Use the Streaming field to specify whether to enable streaming of in-progress transactions for this subscription. The default value is off, meaning all transactions are fully decoded on the publisher and only then sent to the subscriber as a whole. This option is available only on PostgreSQL 14 and above.

  • Use the Binary? switch to specify whether the subscription will request the publisher to send the data in binary format (as opposed to text). The default is false. This option is available only on PostgreSQL 14 and above.

  • Use the Two phase? switch to specify whether two-phase commit is enabled for this subscription. The default is false. This option is available only on PostgreSQL 15 and above.

  • Use the Disable on error? switch to specify whether the subscription should be automatically disabled if any errors are detected by subscription workers during data replication from the publisher. The default is false. This option is available only on PostgreSQL 15 and above.

  • Move the Run as owner? switch to true position to specify all replication actions are performed as the subscription owner. If false, replication workers will perform actions on each table as the owner of that table. The default is false. This option is available only on PostgreSQL 16 and above.

  • Use the Password required? to specify whether connections to the publisher made as a result of this subscription must use password authentication. This setting is ignored when the subscription is owned by a superuser. The default is true. Only superusers can set this value to false. This option is available only on PostgreSQL 16 and above.

  • Use the Origin to specify whether the subscription will request the publisher to only send changes that don’t have an origin or send changes regardless of origin. The default is any. This option is available only on PostgreSQL 16 and above.

Click the SQL tab to continue.

Your entries in the Subscription dialog generate a SQL command (see an example below). Use the SQL tab for review; revisit or switch tabs to make any changes to the SQL command.

Example

The following is an example of the sql command generated by user selections in the Subscription dialog:

Subscription dialog sql tab

The example creates a subscription named sub1 that is owned by postgres. It will replicate the data from the publication pub1.

  • Click the Info button (i) to access online help.

  • Click the Save button to save work.

  • Click the Close button to exit without saving work.

  • Click the Reset button to restore all the default settings.