Root element (DataWarehouse) has been recognised as a list holder (see below), xsd2pgschema will not append unique key constraint for any list holders by default because the uniquness can not be assured when the list holders are referred else where.
-- canonical name: DataWarehouse
-- type: root, content: false, list: true, bridge: true, virtual: false
However, the simple root element without any referencing by <xs:import> or <xs:include> component seems to be exceptional. For the case, it is possible to say that violation to the unique constraint never happens. So, the issue is fixed in the next release.</xs:include></xs:import>
Last edit: Masashi Yokochi 2023-06-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have released v4.4.5 and v5.3.5 to address this issue. The new versions have been tested with the data and confirmed that primary key was created for datawarehouse.datawarehouse_id..
Best regards,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. The primary key gets created for the top level item Datawarehouse, so looks like I need to remove that parent before running the XSD / XML through this tool. Which makes sense.
Thanks a lot for helping with this code change.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I downloaded the xsd2pgschema-4.4.4 jar. My database is Postgres. With the following commands, the primary key and indexes do not get created.
(Convert xsd to ddl)
java -classpath xsd2pgschema.jar xsd2pgschema --xsd "/xsd/DW_DL_AggregateXSD.xsd" --ddl "/ddl/DW_DL_AggregateXSD.ddl" --realize-simple-brdg --doc-key --pg-map-date --pg-map-timestamp --field-annotation --pg-comment-on --ser-key --case-insensitive
(Migrate xml to ddl)
java -classpath xsd2pgschema.jar xml2pgsql --xsd "/xsd/DW_DL_AggregateXSD.xsd" --xml "/xml/DW_DL_Aggregate_20160831000403410.xml" --db-name <dbname> --db-user <user> --db-pass <password> --db-host <postgres_url> --db-port 5432 --min-rows-for-index 0 --update --create-attr-index --create-elem-index --create-doc-key-index --sync "/checksum" --fill-default-value --ser-key --doc-key --max-attr-cols-for-index 10 --max-elem-cols-for-index 10 --validate --well-formed --case-insensitive </postgres_url></password></user></dbname>
Also no indexes get created either. The resulting DDL is attached
Root element (DataWarehouse) has been recognised as a list holder (see below), xsd2pgschema will not append unique key constraint for any list holders by default because the uniquness can not be assured when the list holders are referred else where.
-- canonical name: DataWarehouse
-- type: root, content: false, list: true, bridge: true, virtual: false
However, the simple root element without any referencing by <xs:import> or <xs:include> component seems to be exceptional. For the case, it is possible to say that violation to the unique constraint never happens. So, the issue is fixed in the next release.</xs:include></xs:import>
Last edit: Masashi Yokochi 2023-06-19
Hi Bendre,
Can you provide XSD file?
XSD file attached
DDL output attached
XML attached - first sample
XML attached second sample
Thank you,
I have released v4.4.5 and v5.3.5 to address this issue. The new versions have been tested with the data and confirmed that primary key was created for datawarehouse.datawarehouse_id..
Best regards,
Thanks. The primary key gets created for the top level item Datawarehouse, so looks like I need to remove that parent before running the XSD / XML through this tool. Which makes sense.
Thanks a lot for helping with this code change.