Menu

primary key not getting created

2023-06-15
2023-07-07
  • Upen Bendre

    Upen Bendre - 2023-06-15

    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>

     
  • Upen Bendre

    Upen Bendre - 2023-06-15

    Also no indexes get created either. The resulting DDL is attached

     
  • Masashi Yokochi

    Masashi Yokochi - 2023-06-19

    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
  • Masashi Yokochi

    Masashi Yokochi - 2023-06-19

    Hi Bendre,
    Can you provide XSD file?

     
  • Upen Bendre

    Upen Bendre - 2023-06-19

    XSD file attached

     
  • Upen Bendre

    Upen Bendre - 2023-06-19

    DDL output attached

     
  • Upen Bendre

    Upen Bendre - 2023-06-19

    XML attached - first sample

     
  • Upen Bendre

    Upen Bendre - 2023-06-19

    XML attached second sample

     
  • Masashi Yokochi

    Masashi Yokochi - 2023-06-21

    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,

     
  • Upen Bendre

    Upen Bendre - 2023-06-26

    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.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.