When adding an INDEX with an INCLUDE, the schema dump adds it as part of the indexed columns.
Repro SQL code
CREATE SCHEMA test;
CREATE TABLE test.test_table (
id int PRIMARY KEY,
col1 uuid NOT NULL,
col2 int NOT NULL,
included_col text NOT NULL
);
CREATE INDEX test_table_col1_col2 ON test.test_table (col1, col2) INCLUDE (included_col);
Dump schema
pgschema dump --schema test
Expected output
CREATE TABLE IF NOT EXISTS test_table (
id integer,
col1 uuid NOT NULL,
col2 integer NOT NULL,
included_col text NOT NULL,
CONSTRAINT test_table_pkey PRIMARY KEY (id)
);
CREATE INDEX IF NOT EXISTS test_table_col1_col2 ON test_table (col1, col2) INCLUDE (included_col);
Actual output
CREATE TABLE IF NOT EXISTS test_table (
id integer,
col1 uuid NOT NULL,
col2 integer NOT NULL,
included_col text NOT NULL,
CONSTRAINT test_table_pkey PRIMARY KEY (id)
);
CREATE INDEX IF NOT EXISTS test_table_col1_col2 ON test_table (col1, col2, included_col);
Environment
- PostgreSQL 18.1
- pgschema v1.8.0
When adding an INDEX with an INCLUDE, the schema dump adds it as part of the indexed columns.
Repro SQL code
Dump schema
Expected output
Actual output
Environment