pgschema
pgschema copied to clipboard
Generated columns with NOT NULL constraint are not preserved
When defining a GENERATED ALWAYS column with the NOT NULL constraint pgschema dump does not preserve the NOT NULL constraint:
create table some_table (
id serial primary key,
name varchar(255) not null,
cleaned_name varchar(255) generated always as (lower(name)) stored not null
);
The output of pgschema dump is:
--
-- pgschema database dump
--
-- Dumped from database version PostgreSQL 17.0
-- Dumped by pgschema version 1.4.0
--
-- Name: some_table; Type: TABLE; Schema: -; Owner: -
--
CREATE TABLE IF NOT EXISTS some_table (
id SERIAL,
name varchar(255) NOT NULL,
cleaned_name varchar(255) GENERATED ALWAYS AS (lower((name)::text)) STORED,
CONSTRAINT some_table_pkey PRIMARY KEY (id)
);
just tested this change and it works great, thanks for taking care of that!