pgmq-core

Core types for pgmq-hs, a Haskell client for PGMQ

https://github.com/shinzui/pgmq-hs

Stackage Nightly 2026-10-27:0.7.0.0
Latest on Hackage:0.7.0.0

See all snapshots pgmq-core appears in

MIT licensed and maintained by Nadeem Bitar
This version can be pinned in stack with:pgmq-core-0.7.0.0@sha256:2b0818b7bb9437615e4f2dc3ff1e690a441859631064a379cf2a31ef21f99afb,1666

Module documentation for 0.7.0.0

Core types and type classes for pgmq-hs, a Haskell client library for PGMQ (PostgreSQL Message Queue). Provides Message, Queue, QueueName, and related types used across pgmq-hs packages.

Changes

Revision history for pgmq-core

0.7.0.0 – 2026-10-26

New Features

  • Add ArchivedMessage, a Message plus its archivedAt timestamp, for archive inspection reads.
  • Add hand-written ToJSON instances for Queue, UnvalidatedQueue, Message, ArchivedMessage, TopicBinding, RoutingMatch, TopicSendResult and NotifyInsertThrottle, and FromJSON instances for the first four. Encodings use pgmq’s snake_case columns and explicit null optional fields; archived messages flatten the Message object. Queue decoding validates names while UnvalidatedQueue preserves text. Arbitrary JSON headers normalize explicit null to Nothing; newtype instances and exact numeric int64 message IDs are unchanged. Remove downstream orphan instances for these newly supported types.

Other Changes

  • Golden and exact int64 fixtures pin the published wire contract in design note 020. Tests require tasty-golden 2.3.6 to reject missing fixtures as well as changed bytes.
  • Document that notifyChannelName names an unsupported parent channel for partitioned queues.

0.6.1.1 – 2026-09-25

Coordinated family version bump; core types are unchanged from 0.6.1.0.

0.6.1.0 – 2026-09-16

Coordinated family version bump; core types are unchanged from 0.6.0.0.

0.6.0.0 – 2026-09-10

Coordinated family version bump; core types are unchanged from 0.5.0.0.

0.5.0.0 – 2026-08-06

Breaking Changes

  • Queue names are now validated consistently at every entry path. parseQueueName rejects the empty string and any character outside lowercase ASCII letters, digits, and underscore — previously uppercase was accepted and the empty string passed every check. FromJSON QueueName is now a hand-written instance that validates via parseQueueName; it was newtype-derived, accepting any string of any length, so configuration-loaded names bypassed validation entirely.

    Lowercase-only is a correctness requirement, not a style choice. pgmq’s SQL lowercases physical table names while pgmq.meta stores the caller’s original casing, and the notification trigger looks up the lowercased name. MyQueue and myqueue were therefore two logical queues silently interleaving in one physical table: dropping either destroyed the other’s messages, and a mixed-case notification throttle was never matched by the trigger. Rejection was chosen over normalization because normalizing would silently join pre-existing mixed-case metadata and make the parsed name disagree with what the caller wrote.

    Upgrade note: listQueues re-validates names read back from the database, so a deployment whose pgmq.meta still contains mixed-case rows must run the transactional remediation in docs/design/016-queue-name-validation.md — which preserves topic bindings and notification configuration — before upgrading. Do not update or delete pgmq.meta rows by hand: both child foreign keys cascade on delete.

New Features

  • notifyChannelName :: QueueName -> Text returns the LISTEN/NOTIFY channel a queue’s insert notifications arrive on (pgmq.q_<lowercased name>.INSERT). It is now the contract; do not assemble the name by hand. It lives here rather than in pgmq-hasql because a LISTEN consumer needs a raw connection anyway and may not depend on pgmq-hasql at all.
  • UnvalidatedQueue, a queue listing row whose name is plain Text. pgmq’s server-side validator checks only name length, so any client sharing the database can create a name parseQueueName rejects; this type is what the lenient pgmq-hasql and pgmq-effectful listings decode into.

Other Changes

  • New pgmq-core-test suite pinning both queue-name entry paths, parseQueueName and FromJSON.

0.4.0.1 – 2026-07-14

  • Version bump only — coordinated release with pgmq-migration 0.4.0.1. No source-level changes since 0.4.0.0.

0.4.0.0 – 2026-07-14

  • Version bump only — coordinated release with pgmq-migration 0.4.0.0. No source-level changes since 0.3.0.0.

0.3.0.0 – 2026-05-31

  • Version bump only — coordinated release with pgmq-effectful 0.3.0.0. No source-level changes since 0.2.0.0.

0.2.0.0 – 2026-04-23

  • Version bump only — coordinated release with pgmq-effectful 0.2.0.0. No source-level changes since 0.1.3.0.

0.1.3.0 – 2026-03-12

Other Changes

  • Update documentation URLs from tembo.io to pgmq.github.io
  • Update repository homepage URL to shinzui/pgmq-hs

0.1.2.0 – 2026-03-03

  • Version bump only (no changes)

0.1.1.0 – 2026-02-23

New Features

  • Topic routing types (pgmq 1.11.0+): RoutingKey, TopicPattern, TopicBinding, RoutingMatch, TopicSendResult
  • Notification throttle type: NotifyInsertThrottle
  • Validation functions: parseRoutingKey, routingKeyToText, parseTopicPattern, topicPatternToText
  • Extended PgmqError with InvalidRoutingKey and InvalidTopicPattern constructors

0.1.0.0 – 2026-02-21

  • Initial release
  • Core types: Message, MessageBody, MessageHeaders, MessageId, Queue, QueueName, PgmqError
  • Queue name validation following pgmq-rs conventions
  • Template Haskell Lift instance for QueueName