バージョンごとのドキュメント一覧

DROP SUBSCRIPTION

DROP SUBSCRIPTION <refpurpose>remove a subscription</refpurpose> — サブスクリプションを削除する

概要

DROP SUBSCRIPTION [ IF EXISTS ] name [ CASCADE | RESTRICT ]

説明

<title>Description</title>

<command>DROP SUBSCRIPTION</command> removes a subscription from the database cluster. DROP SUBSCRIPTIONはデータベースクラスタからサブスクリプションを削除します。

To execute this command the user must be the owner of the subscription. このコマンドを実行するには、ユーザはサブスクリプションの所有者でなければなりません。

<command>DROP SUBSCRIPTION</command> cannot be executed inside a transaction block if the subscription is associated with a replication slot. (You can use <command>ALTER SUBSCRIPTION</command> to unset the slot.) サブスクリプションがレプリケーションスロットに紐付けられている場合、DROP SUBSCRIPTIONをトランザクションブロックの内側で実行することはできません。 (スロットの設定を解除するにはALTER SUBSCRIPTIONを使うことができます。)

パラメータ

<title>Parameters</title>
name

The name of a subscription to be dropped. 削除対象のサブスクリプションの名前です。

CASCADE
RESTRICT

These key words do not have any effect, since there are no dependencies on subscriptions. サブスクリプションに依存するものはないので、これらのキーワードは何も効果がありません。

注釈

<title>Notes</title>

When dropping a subscription that is associated with a replication slot on the remote host (the normal state), <command>DROP SUBSCRIPTION</command> will connect to the remote host and try to drop the replication slot (and any remaining table synchronization slots) as part of its operation. This is necessary so that the resources allocated for the subscription on the remote host are released. If this fails, either because the remote host is not reachable or because the remote replication slot cannot be dropped or does not exist or never existed, the <command>DROP SUBSCRIPTION</command> command will fail. To proceed in this situation, first disable the subscription by executing <literal>ALTER SUBSCRIPTION ... DISABLE</literal>, and then disassociate it from the replication slot by executing <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>. After that, <command>DROP SUBSCRIPTION</command> will no longer attempt any actions on a remote host. Note that if the remote replication slot still exists, it (and any related table synchronization slots) should then be dropped manually; otherwise it/they will continue to reserve WAL and might eventually cause the disk to fill up. See also <xref linkend="logical-replication-subscription-slot"/>. リモートホストのレプリケーションスロットに紐付けられているサブスクリプション(これが通常の状態です)を削除するとき、DROP SUBSCRIPTIONはその操作の一部として、リモートホストに接続し、レプリケーションスロット(と残りのテーブル同期スロット)を削除しようとします。 リモートホスト上でサブスクリプションに割り当てられたリソースを解放するために、これが必要となります。 リモートホストに到達できない、あるいはリモートのレプリケーションスロットが削除できない、存在しない、存在したことがない、という理由で削除に失敗した場合、DROP SUBSCRIPTIONコマンドは失敗します。 この状況において先へ進むためには、まずALTER SUBSCRIPTION ... DISABLEを実行してサブスクリプションを無効にし、それからALTER SUBSCRIPTION ... SET (slot_name = NONE)を実行してサブスクリプションとレプリケーションスロットの紐付けを解除してください。 その後ならDROP SUBSCRIPTIONはリモートホスト上で何のアクションも起こそうとしません。 リモートのレプリケーションスロットがそれでも存在する場合、それ (と関連するテーブル同期スロット) を手作業で削除すべきであることに注意してください。 そうしなければ、WALを保存し続け、最終的にはディスクを一杯にしてしまうかもしれません。 31.2.1も参照してください。

If a subscription is associated with a replication slot, then <command>DROP SUBSCRIPTION</command> cannot be executed inside a transaction block. サブスクリプションがレプリケーションスロットと紐付けられている場合、DROP SUBSCRIPTIONをトランザクションブロックの内側で実行することはできません。

<title>Examples</title>

Drop a subscription: サブスクリプションを削除します。

DROP SUBSCRIPTION mysub;

互換性

<title>Compatibility</title>

<command>DROP SUBSCRIPTION</command> is a <productname>PostgreSQL</productname> extension. DROP SUBSCRIPTIONPostgreSQLの拡張です。

関連項目

<title>See Also</title> CREATE SUBSCRIPTION, ALTER SUBSCRIPTION