You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A PSQL exception appears in the log file when executing the database migration from GN 3.12.6 to GN 4.2.2 for the matadatastatus table.
DEBUG [org.hibernate.SQL] - alter table if exists geonetwork.MetadataStatus add constraint FKtih0k768u8kuwxsp8dnm9kru3 foreign key (relatedMetadataStatusId) references geonetwork.MetadataStatus
WARN [org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl] - GenerationTarget encountered exception accepting command : Error executing DDL "alter table if exists geonetwork.MetadataStatus add constraint FKtih0k768u8kuwxsp8dnm9kru3 foreign key (relatedMetadataStatusId) references geonetwork.MetadataStatus" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table if exists geonetwork.MetadataStatus add constraint FKtih0k768u8kuwxsp8dnm9kru3 foreign key (relatedMetadataStatusId) references geonetwork.MetadataStatus" via JDBC Statement
...
Caused by: org.postgresql.util.PSQLException: FEHLER: Anzahl der Quell- und Zielspalten im Fremdschlüssel stimmt nicht überein
Warning
Number of source and target columns in foreign key does not match.
The database migration does not stop.
Consequences during operation may be possible.
To Reproduce
Steps to reproduce the behavior:
Increase loglevel to DEBUG for org.hibernate.SQL and org.hibernate
Start GeoNetwork migration from version 3.12.6 to version 4.2.2
Check the logfile for "org.hibernate"
Expected behavior
No PSQL exception should appear. The metadatastatus table should look the same after migration to GN 4.2.2 as if GN 4.2.2 was set up from scratch.
Log file
DEBUG [org.hibernate.SQL] - alter table if exists geonetwork.MetadataStatus add constraint FKtih0k768u8kuwxsp8dnm9kru3 foreign key (relatedMetadataStatusId) references geonetwork.MetadataStatus
WARN [org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl] - GenerationTarget encountered exception accepting command : Error executing DDL "alter table if exists geonetwork.MetadataStatus add constraint FKtih0k768u8kuwxsp8dnm9kru3 foreign key (relatedMetadataStatusId) references geonetwork.MetadataStatus" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table if exists geonetwork.MetadataStatus add constraint FKtih0k768u8kuwxsp8dnm9kru3 foreign key (relatedMetadataStatusId) references geonetwork.MetadataStatus" via JDBC Statement
...
Caused by: org.postgresql.util.PSQLException: FEHLER: Anzahl der Quell- und Zielspalten im Fremdschlüssel stimmt nicht überein
Desktop (please complete the following information):
GeoNetwork Version: Migrated 4.2.2
Server Application Tomcat 8
Additional context
The error message results from necessary changes to the metadatastatus table, which were not taken into account in the migration scripts during the database migration. When comparing the migrated GN 4.2.2 instance with a bare new GN 4.2.2 instance, the differences are recognizable:
The Primary Key (PK) is no longer composed of the columns changedate, metadataid, statusid & userid. Instead, the PK is defined by the ID column
A new Foreign Key (FK) is created, which refers to the PK of the same table. The creation of the FK has so far failed (see error message)
Possible Solution: Adding a migration script
Proposal for rectification (PostGres DB)
ALTER TABLE IF EXISTS geonetwork.metadatastatus
ALTER COLUMN id SET NOT NULL;
ALTER TABLE IF EXISTS geonetwork.metadatastatus
ALTER COLUMN owner SET NOT NULL;
ALTER TABLE IF EXISTS geonetwork.metadatastatus DROP CONSTRAINT IF EXISTS metadatastatus_pkey;
ALTER TABLE IF EXISTS geonetwork.metadatastatus
ADD CONSTRAINT metadatastatus_pkey PRIMARY KEY (id);
ALTER TABLE IF EXISTS geonetwork.metadatastatus
ADD CONSTRAINT fktih0k768u8kuwxsp8dnm9kru3 FOREIGN KEY (relatedmetadatastatusid)
REFERENCES geonetwork.metadatastatus (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION;
The text was updated successfully, but these errors were encountered:
Describe the bug
A PSQL exception appears in the log file when executing the database migration from GN 3.12.6 to GN 4.2.2 for the matadatastatus table.
Warning
Number of source and target columns in foreign key does not match.
The database migration does not stop.
Consequences during operation may be possible.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No PSQL exception should appear. The metadatastatus table should look the same after migration to GN 4.2.2 as if GN 4.2.2 was set up from scratch.
Log file
Desktop (please complete the following information):
Additional context
The error message results from necessary changes to the metadatastatus table, which were not taken into account in the migration scripts during the database migration. When comparing the migrated GN 4.2.2 instance with a bare new GN 4.2.2 instance, the differences are recognizable:
Possible Solution: Adding a migration script
Proposal for rectification (PostGres DB)
The text was updated successfully, but these errors were encountered: