Skip to main content

create_topic

SQL 0.1.1 · Source cbff27b8a34e1384384018680e46c20d5c610cc9.

Signature​

postgremq.create_topic(p_topic character varying)
RETURNS character varying

The signature, defaults, and result above were extracted from the installed PostgreSQL catalog.

Declare a publication destination​

Creates the named topic or returns the existing name without changing subscriptions. Creating a topic does not create a queue. Names must be nonempty and use ASCII letters, digits, underscore, colon, period, or hyphen, at most 57 bytes.

Transactions and errors​

Invalid or NULL names raise PMQ03. The insert participates in the caller transaction and may wait for conflicting concurrent declarations.

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-events');
SELECT postgremq.create_topic('reference-events');
ROLLBACK;

Both calls return the same name. Rollback removes a topic newly created by this example.

Related: Durable queues, SQL conventions.