Error with new tenant
This page is a capture in the discarded bucket of the product backlog.
Resolved (deep backlog refinement, 2026-07-11): The generic ores_dq_bundles_publish_fn referenced in the error log no longer exists in the codebase (only appears in projects/ores.sql/drop/dq/dq_bundle_publication_drop.sql as a 'drop function if exists' and in docs). It was superseded by the new per-domain publish pattern described in doc/plans/2026-05-14-dq-publish-pattern.org, e.g. projects/ores.sql/create/assets/assets_publish_from_dq_create.sql, whose ores_assets_images_tbl primary key is (tenant_id, image_id, valid_from, valid_to) – correctly scoped per tenant, avoiding the cross-tenant duplicate-key collision described in the capture.
When trying to setup a new tenant, with an already existing tenant we get:
Publishing catalogue 'Crypto'… ERROR: Query execution failed: ERROR: Atomic bundle publication failed at dataset assets.crypto_icons: duplicate key value violates unique constraint "ores_assets_images_tbl_pkey" CONTEXT: PL/pgSQL function ores_dq_bundles_publish_fn(text,uuid,text,text,boolean,jsonb) line 239 at RAISE
Logs:
2026-02-23 23:55:42.970715 [DEBUG] [ores.dq.service.publication_service] publication_service initialized
2026-02-23 23:55:42.970747 [INFO] [ores.dq.service.publication_service] Publishing bundle: crypto with mode: upsert, atomic: true, published_by: tenant_admin, params_json: (empty)
2026-02-23 23:55:42.970813 [DEBUG] [ores.dq.service.publication_service] Publishing bundle crypto. SQL: SELECT * FROM ores_dq_bundles_publish_fn('crypto', 'c5d8e5f6-7e67-4c18-94ba-55e8829a9d57'::uuid, 'upsert', 'tenant_admin', true, '{}'::jsonb)
2026-02-23 23:55:42.986027 [DEBUG] [ores.dq.service.publication_service] Set tenant context to: c5d8e5f6-7e67-4c18-94ba-55e8829a9d57
2026-02-23 23:55:43.030557 [ERROR] [ores.dq.service.publication_service] Query failed: ERROR: Atomic bundle publication failed at dataset assets.crypto_icons: duplicate key value violates unique constraint "ores_assets_images_tbl_pkey"
CONTEXT: PL/pgSQL function ores_dq_bundles_publish_fn(text,uuid,text,text,boolean,jsonb) line 239 at RAISE
2026-02-23 23:55:43.070217 [ERROR] [ores.dq.service.publication_service] Bundle publication failed: Query execution failed: ERROR: Atomic bundle publication failed at dataset assets.crypto_icons: duplicate key value violates unique constraint "ores_assets_images_tbl_pkey"