delete_topic
SQL 0.1.1 · Source cbff27b8a34e1384384018680e46c20d5c610cc9.
Signature
postgremq.delete_topic(p_topic character varying)
RETURNS void
The signature, defaults, and result above were extracted from the installed PostgreSQL catalog.
Remove a topic after draining publishers
Deletes the named topic and its queue declarations by cascade after checking for existing payloads. Completed or unreferenced payloads still count for that check. Stop publishers and let their transactions finish before deleting the topic: in SQL 0.1.1, the check does not protect against concurrent publication. A publication that commits while deletion waits can be cascade-deleted even though its publisher received a message ID.
Transactions and errors
PMQ03: the pre-deletion check sees a payload. This is a snapshot check, not a guarantee against concurrent publication. Missing topic is a no-op. Transactional deletion can block concurrent references and removes queue identity on commit; resolve data deliberately before using it.
All calls require the applicable caller privileges. See SQL errors for driver failures and uncertain outcomes.
Example
Run in psql with ON_ERROR_STOP and fresh reference-* names. ROLLBACK removes the fixtures.
BEGIN;
SELECT postgremq.create_topic('reference-empty');
SELECT postgremq.create_queue('reference-empty-jobs', 'reference-empty');
SELECT postgremq.delete_topic('reference-empty');
ROLLBACK;
The empty topic and queue are deleted inside this transaction. This is not a command to purge existing messages first.
Related: Topology, SQL conventions.