fix(ekosystem): register_tenant — RETURN QUERY + smallint cast

INSERT ... RETURNING needs RETURN QUERY in PL/pgSQL RETURNS TABLE functions.
tenant_id column is smallint in knoe.tenants; cast to integer to match
the function's declared return type.

Reproduced on pg.prole.org at 2026-05-30 during Phase 2 canary deploy.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
chrisfu 2026-05-30 02:18:09 -07:00
parent d114801758
commit 23cf4a8585

View File

@ -179,11 +179,10 @@ BEGIN
v_uuid := knoe.ekosystem_id(0, 0); -- root authority mints the UUID v_uuid := knoe.ekosystem_id(0, 0); -- root authority mints the UUID
INSERT INTO knoe.tenants (tenant_id, uuid, name) RETURN QUERY
VALUES (v_tenant_id, v_uuid, p_name) INSERT INTO knoe.tenants (tenant_id, uuid, name)
RETURNING tenants.tenant_id, tenants.uuid, tenants.name; VALUES (v_tenant_id::smallint, v_uuid, p_name)
RETURNING tenants.tenant_id::integer, tenants.uuid, tenants.name;
RETURN NEXT;
END; END;
$$; $$;