[check_postgres] Strange message from the same_schema action

Guillaume Lelarge guillaume at lelarge.info
Tue Apr 6 21:26:08 UTC 2010


Hi,

I created two databases:

 * database cp1

CREATE TABLE t1 (
    c1 integer NOT NULL,
    c2 integer
);
CREATE TABLE t2 (
    c1 integer NOT NULL,
    c2 integer,
    c1_de_t1 integer
);
ALTER TABLE ONLY t1
    ADD CONSTRAINT t1_pkey PRIMARY KEY (c1);
ALTER TABLE ONLY t2
    ADD CONSTRAINT t2_pkey PRIMARY KEY (c1);
ALTER TABLE ONLY t2
    ADD CONSTRAINT t2_c1_de_t1_fkey FOREIGN KEY (c1_de_t1)
    REFERENCES t1(c1);

 * database cp2

CREATE TABLE t1 (
    c1 integer NOT NULL,
    c2 integer
);
CREATE TABLE t2 (
    c1 integer NOT NULL,
    c2 integer,
    c1_de_t1 integer
);
ALTER TABLE ONLY t1
    ADD CONSTRAINT t1_pkey PRIMARY KEY (c1);
ALTER TABLE ONLY t2
    ADD CONSTRAINT t2_pkey PRIMARY KEY (c1);

As you can see, the only difference is that database cp2 has no fk
constraint between table t1 and table t2. Here is the output of the
same_schema action:

LANG=C ./check_postgres.pl --action same_schema --verbose --dbname cp1
--dbname2 cp2

POSTGRES_SAME_SCHEMA CRITICAL: DB "cp1 => cp2" Databases were different.
Items not matched: 1 | time=0.01
Table "public.t1" on 1 has constraint "public.t2_c1_de_t1_fkey", but 2
does not.

AFAICT, table t1 has no constraint. The constrained one is t2. Don't you
think? I can work on a patch if it helps.


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com


More information about the Check_postgres mailing list