sfa-siard / siard-suite

Other
5 stars 0 forks source link

Upload to Postgres: Siard tries to create schema twice #101

Open MarkusGehrig opened 3 months ago

MarkusGehrig commented 3 months ago

When uploading a Siard file to postgres, it looks like Siard is trying to create the database schemas twice. We are using SIARD 2.2.145 and PostgreSQL 16.3 with a freshly created database. The SIARD file contains several schemas. These schemas come from an Oracle database.

java.sql.SQLException: Schema "AG_BG_AAR" could not be created! Map "AG_BG_AAR" to existing schema. at ch.admin.bar.siard2.cmd.MetaDataToDb.upload(MetaDataToDb.java:591) at ch.admin.bar.siardsuite.service.database.DatabaseUploadService$DatabaseUploadTask.call(DatabaseUploadService.java:70) at ch.admin.bar.siardsuite.service.database.DatabaseUploadService$DatabaseUploadTask.call(DatabaseUploadService.java:39) at javafx.graphics/javafx.concurrent.Task$TaskCallable.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at javafx.graphics/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at javafx.graphics/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)

mburri commented 3 months ago

@MarkusGehrig Are you sure that the schema is created twice? A quick glance at the code showed me, that error is thrown if the schema does not yet exist. Could you try to create the schemas in PostgresQL first? Does the same error occur?

Otherwise, it would be best for us if you could provide a minimal siard archive that reproduces the problem.

MarkusGehrig commented 3 months ago

@mburri

Thank you for your reply. It seems that SIARD created the schemas. I can see all the schemas that the source had in PostgreSQL.

In our test the database was empty, with no custom schemas or tables. The schemas you see in the picture below are created by SIARD at execution time.

c6ede88b-cb8d-4af6-8c08-95b29d3d21d3

A minimal SIARD archive is out of the question at the moment. The data we want to archive is strictly confidential and I'm not allowed to share it with you. Maybe I can try to get you some test data from a test system without confidential data, but first I would have to set up a new user with our DBA, which is not straightforward.

mburri commented 3 months ago

Ok - I'll try to reproduce it myself and will report back