These are the raw PgQ primitives that the modernDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/NikolayS/PgQue/llms.txt
Use this file to discover all available pages before exploring further.
send/receive/ack/nack API wraps. Most callers should use the modern API instead. Primitives are useful for advanced integrations, custom batch logic, or when you need direct access to tick boundaries.
Prefer
pgque.send(), pgque.receive(), pgque.ack(), and pgque.nack() for new code. The primitives are available for advanced use cases and are what the modern API delegates to internally.insert_event
ev_extra* columns null. Returns the event id. Grant: pgque_writer.
register_consumer / unregister_consumer
register_consumer starts the consumer from the most recent tick. register_consumer_at positions it at a specific historical tick id. unregister_consumer removes the subscription and its retry-queue entries — cooperative-aware: raises if the consumer is a coop_main with registered subconsumers.
Grant: pgque_reader for all three.
next_batch / next_batch_info / next_batch_custom
next_batch activates the next batch and returns its id, or NULL if no events are ready. next_batch_info returns the same plus tick bounds. next_batch_custom adds size and age constraints.
Out columns for next_batch_info and next_batch_custom: batch_id, cur_tick_id, prev_tick_id, cur_tick_time, prev_tick_time, cur_tick_event_seq, prev_tick_event_seq.
Grant: pgque_reader.
get_batch_events
ev_id bigint, ev_time timestamptz, ev_txid bigint, ev_retry int4, ev_type text, ev_data text, ev_extra1 text, ev_extra2 text, ev_extra3 text, ev_extra4 text.
Grant: pgque_reader.
get_batch_cursor
quick_limit events. Fetch remaining events with FETCH … FROM <cursor_name>. Grant: pgque_admin only.
finish_batch
last_tick. Returns 1 on success, 0 with a warning if the batch was not found. Cooperative-aware: coop_member batches clear the member cursor; coop_main batches are rejected. Grant: pgque_reader.
event_retry / batch_retry
event_retry puts one event back onto the retry queue. batch_retry re-queues every event in the batch. Returns 1 on success per event, 0 if already queued.
Grant: pgque_reader for event_retry; pgque_admin for batch_retry.
CDC trigger helpers
Attach these trigger functions to any table to automatically enqueue an event on every INSERT/UPDATE/DELETE. Grant:pgque_admin.
jsontriga
Emits row data as JSON.ev_data is the JSON blob; ev_extra1 is the fully-qualified table name. Supports optional trigger args: SKIP, backup, ignore=col, pkey=col, when=expr, ev_type=expr, ev_extra1..4=expr.
logutriga
Emits row data as URL-encoded key/value pairs (key1=v1&key2=v2). Useful for legacy pipelines that already consume logutriga format.
sqltriga
Emits row data as ready-to-apply SQL:INSERT … VALUES …, UPDATE … SET … WHERE …, or DELETE FROM … WHERE … in ev_data.
Cooperative consumer primitives
subscribe_subconsumer and unsubscribe_subconsumer are aliases for register_subconsumer and unregister_subconsumer. See the fan-out guide for usage patterns. Grant: pgque_reader.