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

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 <link linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION</command></link> to unset the slot.) サブスクリプションがレプリケーションスロットに紐付けられている場合、DROP SUBSCRIPTIONをトランザクションブロックの内側で実行することはできません。 (スロットの設定を解除するにはALTER SUBSCRIPTIONを使うことができます。)

パラメータ

<title>Parameters</title>
IF EXISTS

Do not throw an error if the subscription does not exist. A notice is issued in this case. サブスクリプションが存在しない場合でもエラーとしません。 この場合には、注意が発行されます。

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 <link linkend="sql-altersubscription-params-disable"> <literal>ALTER SUBSCRIPTION ... DISABLE</literal></link>, and then disassociate it from the replication slot by executing <link linkend="sql-altersubscription-params-set"> <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal></link>. After that, <command>DROP SUBSCRIPTION</command> will not attempt to drop the subscription's own replication slot. It may still connect to the publisher to drop internally-created table synchronization slots if some table synchronization is left unfinished; if the publisher is unreachable, those slots (and the main slot, if it still exists) must 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"/>. 《マッチ度[82.352941]》リモートホストのレプリケーションスロットに紐付けられているサブスクリプション(これが通常の状態です)を削除するとき、DROP SUBSCRIPTIONはその操作の一部として、リモートホストに接続し、レプリケーションスロット(と残りのテーブル同期スロット)を削除しようとします。 リモートホスト上でサブスクリプションに割り当てられたリソースを解放するために、これが必要となります。 リモートホストに到達できない、あるいはリモートのレプリケーションスロットが削除できない、存在しない、存在したことがない、という理由で削除に失敗した場合、DROP SUBSCRIPTIONコマンドは失敗します。 この状況において先へ進むためには、まずALTER SUBSCRIPTION ... DISABLEを実行してサブスクリプションを無効にし、それからALTER SUBSCRIPTION ... SET (slot_name = NONE)を実行してサブスクリプションとレプリケーションスロットの紐付けを解除してください。 その後ならDROP SUBSCRIPTIONはリモートホスト上で何のアクションも起こそうとしません。 リモートのレプリケーションスロットがそれでも存在する場合、それ (と関連するテーブル同期スロット) を手作業で削除すべきであることに注意してください。 そうしなければ、WALを保存し続け、最終的にはディスクを一杯にしてしまうかもしれません。 29.2.1も参照してください。 《機械翻訳》リモートホストのサブスクリプションに関連付けられたレプリケーションスロットを削除する場合(通常の状態)、DROP SUBSCRIPTIONはリモートホストとトライに接続して、レプリケーションスロット(および残りのテーブル同期化スロット)をオペレーションのパートとして削除します。 これは、リモートホストのサブスクリプションに割り当てられたリソースが解放されるようにするために必要です。 リモートホストが到達不能であるか、リモートレプリケーションスロットが削除できないか、存在しないか、存在しなかったために、これが失敗した場合、DROP SUBSCRIPTIONコマンドは失敗します。 このシチュエーションで処理を続行するには、まずALTER SUBSCRIPTION ... DISABLEを実行してサブスクリプションを無効にし、ALTER SUBSCRIPTION ... SET (slot_name = NONE)を実行してレプリケーションスロットとの関連付けを解除します。 その後、DROP SUBSCRIPTIONはサブスクリプション自身のレプリケーションスロットを削除しようとしません。 テーブルの同期化が完了していない場合は、パブリッシャーに接続して、内部で作成されたテーブル同期化スロットを削除することができます。 パブリッシャーが到達不能な場合は、それらのスロット(およびがまだ存在する場合は)を手動で削除する必要があります。 それ以外の場合は、WALの予約が継続され、最終的にディスクがいっぱいになる可能性があります。 29.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