Commit Graph
1 Commits
Author SHA1 Message Date
c777ca1c74 fix(studio): quote pgmq.create_partitioned interval args as text to f… (#52480)
## Problem

Creating a **partitioned queue** from the dashboard (Integrations →
Queues → Create queue)
  fails with:

  ```
Failed to create database queue: function
pgmq.create_partitioned(unknown, integer, integer) does not exist
  ```

The form submits `partitionInterval` / `retentionInterval` as numbers,
and `literal()`
in pg-format renders numbers unquoted, so the generated SQL passes bare
integers while
  `pgmq.create_partitioned` declares these parameters as `text`.

  Fixes #52479

  ## Solution

Convert the intervals with `String()` before passing them to `literal()`
so quoted text
  literals are generated, matching the function signature:

  ```sql
  select from pgmq.create_partitioned('my_queue', '10000', '100000');
  ```

When both intervals are unset, the arguments are omitted entirely so the
function
  defaults (`'10000'` / `'100000'`) apply instead of explicit `NULL`s.

  Basic and unlogged queue creation are untouched.

  ## Review instructions

1. Enable the Queues integration on a project running pgmq whose
`create_partitioned`
     takes text args (e.g. self-hosted / pgmq 1.5.x)
  2. Go to Integrations → Queues → Create queue
  3. Select "Partitioned queue" (default) and click Create queue
  4. Verify the queue appears in the list, and
     `select * from pgmq.list_queues()` reports `is_partitioned = true`

  ## Checklist

  Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style guide](https://github.com/supabase/supabase/tree/master
  /apps/docs/style-guide)

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 14:39:03 +01:00