Another PostgreSQL Diff Tool (apgdiff) free database schema diff tool

Awards

Famous Software Download

Supported Features

Supported Statements

Here are supported SQL statements and their supported features. If at the end of statement there is ..., it means that the part is taken as a string and not parsed for details, so it is used for diffing as string.

ALTER SEQUENCE

ALTER SEQUENCE name
     OWNED BY { table_name.column_name | NONE }

ALTER TABLE

ALTER TABLE [ ONLY ] table_name
     ALTER [ COLUMN ] SET DEFAULT expression
     ALTER [ COLUMN ] SET STATISTICS integer
     ALTER [ COLUMN ] SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
     ADD FOREIGN KEY ( column [, ... ] ) ...
     ADD CONSTRAINT constraint_name
     DISABLE TRIGGER [ trigger_name | ALL | USER ]
     ENABLE TRIGGER [ trigger_name | ALL | USER ]
     ENABLE REPLICA TRIGGER trigger_name
     ENABLE ALWAYS TRIGGER trigger_name
     DISABLE RULE rewrite_rule_name
     ENABLE RULE rewrite_rule_name
     ENABLE REPLICA RULE rewrite_rule_name
     ENABLE ALWAYS RULE rewrite_rule_name
     CLUSTER ON index_name
     OWNER TO new_owner

ALTER TABLE view_name
    ALTER [ COLUMN ] SET DEFAULT expression
    ALTER [ COLUMN ] DROP DEFAULT
    OWNER TO new_owner

ALTER TABLE sequence_name
    OWNER TO new_owner

ENABLE|DISABLE TRIGGER|RULE and OWNER TO are parsed but not diffed.

ALTER VIEW

ALTER VIEW name ALTER [ COLUMN ] column SET DEFAULT expression
ALTER VIEW name ALTER [ COLUMN ] column DROP DEFAULT
ALTER VIEW name OWNER TO new_owner

OWNER TO is parsed but not diffed.

COMMENT

COMMENT ON
{
  TABLE object_name |
  COLUMN table_name.column_name |
  CONSTRAINT constraint_name ON table_name |
  DATABASE object_name |
  FUNCTION function_name ( [ [ argmode ] [ argname ] argtype [, ...] ] ) |
  INDEX object_name |
  SCHEMA object_name |
  SEQUENCE object_name |
  TRIGGER trigger_name ON table_name |
  VIEW object_name
} IS 'text'

CREATE FUNCTION

CREATE [ OR REPLACE ] FUNCTION
name ( [ [ argmode ] [ argname ] argtype [ { DEFAULT | = } default_expr ] [, ...] ] ) ...

CREATE INDEX

CREATE [ UNIQUE ] INDEX name ON table ...

Note that here name is required whereas PostgreSQL does not require it.

CREATE SCHEMA

CREATE SCHEMA schema_name [ AUTHORIZATION user_name ] ...
CREATE SCHEMA AUTHORIZATION user_name ...

CREATE SEQUENCE

CREATE SEQUENCE name [ INCREMENT [ BY ] increment ]
[ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
[ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
[ OWNED BY { table.column | NONE } ]

CREATE TABLE

CREATE TABLE [ IF NOT EXISTS ] name ( [
{ column_name data_type [ DEFAULT default_expr ] [ column_constraint [ ... ] ]
| CONSTRAINT constraint_name ...
] )
[ INHERITS ( parent_table [, ... ] ) ]
[ WITH ( ... ) | WITH OIDS | WITHOUT OIDS ]
[ TABLESPACE tablespace ]

From column_constraint, only NULL and NOT NULL are supported.

CREATE TRIGGER

CREATE TRIGGER name { BEFORE | AFTER } { event [ OR ... ] }
ON table [ FOR [ EACH ] { ROW | STATEMENT } ]
[ WHEN ( condition ) ]
EXECUTE PROCEDURE function_name ( arguments )

where event can be one of:

    INSERT
    UPDATE [ OF column_name [, ... ] ]
    DELETE
    TRUNCATE

CREATE VIEW

CREATE [ OR REPLACE ] VIEW name [ ( column_name [, ...] ) ]
AS ...

SET search_path

SET search_path = schema [, ...]

Only supported for search_path.

Other SQL Statements

Other SQL statements are ignored by apgdiff. If you want apgdiff to support them, file a bug at GitHub Issues Tracker. Also, you can use --output-ignored-statements command line switch to see what statements apgdiff ignores when creating the diff.

Download
Another PostgreSQL Diff Tool
Version 2.4