Bug Description
When comparing two identical tables using Schema Diff (where both tables use BIGSERIAL / SERIAL columns with identical definitions), Schema Diff incorrectly flags the table as different. Furthermore, it generates an invalid SQL script attempting to change the column type to bigserial (ALTER COLUMN ... TYPE bigserial;), which is syntactically invalid in PostgreSQL.
To Reproduce
Steps to reproduce the behavior:
SQL
CREATE TABLE public.ges_adelantos
(
adl_id bigserial NOT NULL,
adl_grupo integer NOT NULL,
adl_empresa integer NOT NULL,
adl_persona integer NOT NULL,
adl_ciclo integer,
adl_moneda integer,
adl_valor_adelanto numeric(25,6),
adl_valor_saldo numeric(25,6),
adl_bajado numeric(25,6),
adl_situacion character varying(1) COLLATE pg_catalog."default",
adl_tipo character varying(1) COLLATE pg_catalog."default",
adl_id_factura_inclusion integer,
CONSTRAINT ges_adelantos_pkey PRIMARY KEY (adl_id)
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.ges_adelantos
OWNER to postgres;
-
Run the Schema Diff process between Source and Target.
-
Observe that the table is marked as modified.
-
Inspect the generated DDL script under Differences / DDL Comparison.
Expected Behavior
Schema Diff should recognize that both table schemas are structurally identical and should not mark them as different (or should gracefully ignore minor underlying sequence metadata mismatches when the table definitions match).
The generated diff SQL should NOT contain invalid syntax such as ALTER COLUMN <col_name> TYPE bigserial;, since bigserial is a pseudo-type in PostgreSQL and cannot be used in ALTER TABLE ... ALTER COLUMN ... TYPE statements.
Generated DDL (Incorrect)
SQL
ALTER TABLE public.ges_adelantos
ALTER COLUMN adl_id TYPE bigserial;
ALTER TABLE IF EXISTS public.ges_adelantos
ALTER COLUMN adl_id DROP DEFAULT;
ALTER TABLE IF EXISTS public.ges_adelantos
ALTER COLUMN adl_id SET INCREMENT 1 RESTART SET START 1 SET MINVALUE 1 SET MAXVALUE 9223372036854775807 SET CACHE 1;
Desktop Environment
OS: Windows 11
pgAdmin Version: 9.17
Mode: Desktop Mode
PostgreSQL Version: 15
Bug Description
When comparing two identical tables using Schema Diff (where both tables use BIGSERIAL / SERIAL columns with identical definitions), Schema Diff incorrectly flags the table as different. Furthermore, it generates an invalid SQL script attempting to change the column type to bigserial (ALTER COLUMN ... TYPE bigserial;), which is syntactically invalid in PostgreSQL.
To Reproduce
Steps to reproduce the behavior:
Open Schema Diff tool in pgAdmin 4.
Select a Source and Target database that both contain a table with a BIGSERIAL column created as follows:
SQL
Run the Schema Diff process between Source and Target.
Observe that the table is marked as modified.
Inspect the generated DDL script under Differences / DDL Comparison.
Expected Behavior
Schema Diff should recognize that both table schemas are structurally identical and should not mark them as different (or should gracefully ignore minor underlying sequence metadata mismatches when the table definitions match).
The generated diff SQL should NOT contain invalid syntax such as ALTER COLUMN <col_name> TYPE bigserial;, since bigserial is a pseudo-type in PostgreSQL and cannot be used in ALTER TABLE ... ALTER COLUMN ... TYPE statements.
Generated DDL (Incorrect)
SQL
Desktop Environment
OS: Windows 11
pgAdmin Version: 9.17
Mode: Desktop Mode
PostgreSQL Version: 15