#21241·bytebase

Declarative (SDL) rollout fails on Spilo/postgres-operator databases: type "pg_stat_statements" does not exist (SQLSTATE 42704)

Author: chriskovaiosCreated Aug 25, 2026Updated Sep 3, 2026

Provide the Bytebase version you are using

3.21.0

Describe the bug

Hey again, thanks for the incredible support in regards to my previous issue #20434 !!

I'd like to report one more problem relative to one of my previous bugs, which came after the fixes.

Apparently the "metric_helpers" error came from Zalando's Spilo Wrapper, in which they have a function called pg_stat_statements as stated below. metric_helpers.sql :

sql
CREATE EXTENSION pg_stat_statements;
CREATE SCHEMA metric_helpers;
CREATE FUNCTION metric_helpers.pg_stat_statements(showtext boolean)
 RETURNS SETOF public.pg_stat_statements
 LANGUAGE sql IMMUTABLE STRICT SECURITY DEFINER
AS $$ SELECT * FROM public.pg_stat_statements(showtext) $$;

Steps to reproduce

Trying to create a rollout with a bootstrapped postgres out of the box Zalando Spilo's postgres-operator will reproduce the error.

Expected behavior

SDL to work properly for DDL

Provide the database you are using

PostgreSQL v16 LTS

Additional context

I've run this problem through Claude and it's suggested solution goes like this:

Add pg_stat_statements to the bundled extensionScripts map with a minimal script declaring the pg_stat_statements view (a superset column list across extension versions is sufficient for DDL semantic analysis), like the existing bundles for citext/hstore/pg_trgm/vector. pg_stat_kcache and pg_auth_mon (also installed by Spilo by default) may deserve the same treatment.