Skip to content

Issue with generated columns #183

@michalgm

Description

@michalgm

The dump parser seems to be having issues with some of my columns, where it is dumping incomplete/invalid syntax.
some examples:

pg_dump:

CREATE TABLE snapshots (
    snapshot_id integer NOT NULL,
    archive_id integer NOT NULL,
    title character varying(100) DEFAULT ''::character varying NOT NULL,
    date_published timestamp with time zone DEFAULT now(),
    records_count integer DEFAULT 0,
    collections_count integer DEFAULT 0,
    max_record_date timestamp with time zone,
    max_collection_date timestamp with time zone,
    is_live boolean GENERATED ALWAYS AS (((title)::text = 'Public Data'::text)) STORED
);

pgschema dump:

CREATE TABLE IF NOT EXISTS snapshots (
    snapshot_id SERIAL PRIMARY KEY,
    archive_id integer NOT NULL REFERENCES archives(archive_id),
    title varchar(100) DEFAULT '' NOT NULL,
    date_published timestamptz DEFAULT now(),
    records_count integer DEFAULT 0,
    collections_count integer DEFAULT 0,
    max_record_date timestamptz,
    max_collection_date timestamptz,
    is_live boolean DEFAULT ((title)::text = 'Public Data'
);

pg_dump:

CREATE TABLE users (
    user_id integer NOT NULL,
    archive_id integer NOT NULL,
    username text NOT NULL,
    firstname text,
    lastname text,
    role freedom_archives.user_role,
    password text,
    active boolean DEFAULT false,
    email text,
    full_name text GENERATED ALWAYS AS (TRIM(BOTH FROM ((firstname || ' '::text) || lastname))) STORED,
    user_search text GENERATED ALWAYS AS (TRIM(BOTH FROM ((((((username || ' '::text) || firstname) || ' '::text) || lastname) || ' '::text) || email))) STORED
);

pgschema_dump:

CREATE TABLE IF NOT EXISTS users (
    user_id SERIAL PRIMARY KEY,
    archive_id integer NOT NULL REFERENCES archives(archive_id),
    username text NOT NULL UNIQUE,
    firstname text,
    lastname text,
    role user_role,
    password text,
    active boolean DEFAULT false,
    email text,
    full_name text DEFAULT TRIM(BOTH FROM ((firstname || ' ',
    user_search text DEFAULT TRIM(BOTH FROM ((((((username || ' '
);

CREATE TABLE list_items (
    list_item_id integer NOT NULL,
    archive_id integer,
    item text NOT NULL,
    fulltext tsvector GENERATED ALWAYS AS (to_tsvector('english'::regconfig, COALESCE(item, ''::text))) STORED,
    search_text text GENERATED ALWAYS AS (lower(COALESCE(item, ''::text))) STORED,
    type text NOT NULL,
    description text
);
CREATE TABLE IF NOT EXISTS list_items (
    list_item_id SERIAL PRIMARY KEY,
    archive_id integer REFERENCES archives(archive_id) ON DELETE CASCADE,
    item text NOT NULL,
    fulltext tsvector DEFAULT to_tsvector('english',
    search_text text DEFAULT lower(COALESCE(item, '',
    type text NOT NULL,
    description text
);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions