Netdot
Netdot copied to clipboard
Postgres upgrading 104_105 fails
I think this first part is caused by two statements being out of order, but I'm not sure.
NOTICE: CREATE TABLE will create implicit sequence "asn_id_seq" for serial column "asn.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pk_asn" for table "asn"
NOTICE: CREATE TABLE / UNIQUE will create implicit index "asn1" for table "asn"
DBD::Pg::db do failed: ERROR: insert or update on table "device" violates foreign key constraint "fk_bgplocalas"
DETAIL: Key (bgplocalas)=(0) is not present in table "asn". at ../lib/DBUTIL.pm line 589.
ERROR while executing ALTER TABLE device ADD CONSTRAINT "fk_bgplocalas" FOREIGN KEY ("bgplocalas") REFERENCES "asn" ("id") DEFERRABLE: DBD::Pg::db do failed: ERROR: insert or update on table "device" violates foreign key constraint "fk_bgplocalas"
DETAIL: Key (bgplocalas)=(0) is not present in table "asn". at ../lib/DBUTIL.pm line 589.
Second problem appears to be this:
push @statements, 'DROP CONSTRAINT "rrds1";';
push @statements, 'ALTER TABLE bgppeering ADD CONSTRAINT "rrds1" UNIQUE ("rr", "key_tag", "algorithm", "digest_type");';
I think it should be:
ALTER TABLE rrds DROP CONSTRAINT rrds1;
ALTER TABLE rrds ADD CONSTRAINT "rrds1" UNIQUE ("rr", "key_tag", "algorithm", "digest_type");
DBD::Pg::db do failed: ERROR: syntax error at or near "CONSTRAINT" LINE 1: DROP CONSTRAINT "rrds1"
^ at ../lib/DBUTIL.pm line 589.
ERROR while executing DROP CONSTRAINT "rrds1": DBD::Pg::db do failed:
ERROR: syntax error at or near "CONSTRAINT" LINE 1: DROP CONSTRAINT "rrds1"
^ at ../lib/DBUTIL.pm line 589.
DBD::Pg::db do failed: ERROR: column "rr" named in key does not exist at ../lib/DBUTIL.pm line 589.
ERROR while executing ALTER TABLE bgppeering ADD CONSTRAINT "rrds1" UNIQUE ("rr", "key_tag", "algorithm", "digest_type"): DBD::Pg::db do failed
ERROR: column "rr" named in key does not exist at ../lib/DBUTIL.pm line 589.
Finally, it appears that the new asn table is created with the postgres user and not given permission to be used by netdot_user. I get this:
DBD::Pg::st execute failed: ERROR: permission denied for relation asn [for Statement "SELECT COUNT(*)
Fixed with:
grant select,insert,update,delete on asn to netdot_user;