mirror of
https://github.com/zitadel/zitadel.git
synced 2026-07-25 18:28:00 +00:00
# Which Problems Are Solved When starting Zitadel with Postgres version 18, setup fails with the following error: `level=error msg="migration failed" caller=".../cmd/setup/setup.go:373" code=0A000 detail= error="ERROR: partitioned tables cannot be unlogged (SQLSTATE 0A000)" hint= message="partitioned tables cannot be unlogged" name=34_add_cache_schema severity=ERROR` # How the Problems Are Solved - Modify setup step 34 to ensure compatibility with PostgreSQL 18 by changing the creation of the partitioned tables to`LOGGED` tables but keep the partitions `UNLOGGED`. - Added an additional setup step which alters the table persistence of the partitioned tables to `LOGGED`. # Additional Changes - Bumped Postgres compatibility to version 18 in docs. - Ensure default partitions for cache tables ## Additional Context - closes https://github.com/zitadel/zitadel/issues/10712 - backport to v4 - migration from PostgreSQL version 17 to 18 was verified using `pg_dumpall` and restoring the created backup file - and new setups using PostgreSQL version 18 directly --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
36 lines
1.1 KiB
SQL
36 lines
1.1 KiB
SQL
create schema if not exists cache;
|
|
|
|
create table if not exists cache.objects (
|
|
cache_name varchar not null,
|
|
id uuid not null default gen_random_uuid(),
|
|
created_at timestamptz not null default now(),
|
|
last_used_at timestamptz not null default now(),
|
|
payload jsonb not null,
|
|
|
|
primary key(cache_name, id)
|
|
)
|
|
partition by list (cache_name);
|
|
|
|
create unlogged table if not exists cache.objects_default
|
|
PARTITION OF cache.objects DEFAULT;
|
|
|
|
create table if not exists cache.string_keys(
|
|
cache_name varchar not null check (cache_name <> ''),
|
|
index_id integer not null check (index_id > 0),
|
|
index_key varchar not null check (index_key <> ''),
|
|
object_id uuid not null,
|
|
|
|
primary key (cache_name, index_id, index_key),
|
|
constraint fk_object
|
|
foreign key(cache_name, object_id)
|
|
references cache.objects(cache_name, id)
|
|
on delete cascade
|
|
)
|
|
partition by list (cache_name);
|
|
|
|
create index if not exists string_keys_object_id_idx
|
|
on cache.string_keys (cache_name, object_id); -- for delete cascade
|
|
|
|
create unlogged table if not exists cache.string_keys_default
|
|
PARTITION OF cache.string_keys DEFAULT;
|