MichaelDBA/pg_get_tabledef

Generated user-defined column not defined correctly

MichaelDBA opened this issue · 1 comments

Valid Table definition:

CREATE TABLE myschema.mytable (
    id uuid NOT NULL,
    email public.citext NOT NULL,
    searchable tsvector GENERATED ALWAYS AS (to_tsvector('simple'::regconfig, COALESCE(public.translate(email, '@.-'::public.citext, ' '::text), ''::text))) STORED,
    searchable2 tsvector DEFAULT to_tsvector('simple'::regconfig, ''::text)
);

Invalid output:

CREATE  TABLE myschema.mytable (
   id uuid NOT NULL, 
   email public.citext NOT NULL,
   searchable tsvector NULL
 ) TABLESPACE pg_default;

Output misses an entire column ("searchable2") and wrongly defines the other vector column ("searchable").

Fixed with the latest version for autogenerated columns.