View Issue Details

IDProjectCategoryView StatusLast Update
0005722SymmetricDSBugpublic2023-03-14 14:53
Reporterumssoft Assigned Topmarzullo  
Priorityurgent 
Status closedResolutionfixed 
Product Version3.14.5 
Target Version3.14.6Fixed in Version3.14.6 
Summary0005722: Tries to create foreign key before creating the referenced table
Description2023-03-04 01:52:03,072 INFO [kiosk-001] [DefaultDatabaseWriter] [kiosk-001-dataloader-109] About to create table using the following definition: <?xml version="1.0"?>
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
<database name="dataextractor" schema="UserSystem">
    <table name="UserPersonalSettings">
        <column name="UserId" primaryKey="true" primaryKeySeq="1" required="true" type="INTEGER" size="10">
            <platform-column name="postgres95" type="int4" size="10"/>
        </column>
        <column name="MainThemeId" type="INTEGER" size="10">
            <platform-column name="postgres95" type="int4" size="10"/>
        </column>
        <column name="SingleClickActionId" type="INTEGER" size="10">
            <platform-column name="postgres95" type="int4" size="10"/>
        </column>
        <column name="OpenScheduleId" required="true" type="INTEGER" size="10" default="2">
            <platform-column name="postgres95" type="int4" size="10" default="2"/>
        </column>
        <column name="ChartTypeIds" type="LONGVARCHAR">
            <platform-column name="postgres95" type="text"/>
        </column>
        <column name="GatewayModeId" required="true" type="INTEGER" size="10" default="1">
            <platform-column name="postgres95" type="int4" size="10" default="1"/>
        </column>
        <foreign-key name="UserPersonalSettings_UserId_fk" foreignTable="User" foreignTableCatalog="" foreignTableSchema="" foreignOnUpdateAction="CASCADE" foreignOnDeleteAction="CASCADE">
            <reference local="UserId" foreign="Id"/>
        </foreign-key>
    </table>
</database>
2023-03-04 01:52:03,088 INFO [kiosk-001] [PostgreSql95DatabasePlatform] [kiosk-001-dataloader-109] Running alter sql:
ALTER TABLE "UserSystem"."UserPersonalSettings"
    ADD CONSTRAINT "UserPersonalSettings_UserId_fk" FOREIGN KEY ("UserId") REFERENCES "UserSystem"."User" ("Id") ON DELETE CASCADE ON UPDATE CASCADE;

2023-03-04 01:52:03,088 WARN [kiosk-001] [JdbcSqlTemplate] [kiosk-001-dataloader-109] ОШИБКА: отношение "UserSystem.User" не существует. Failed to execute: ALTER TABLE "UserSystem"."UserPersonalSettings"
    ADD CONSTRAINT "UserPersonalSettings_UserId_fk" FOREIGN KEY ("UserId") REFERENCES "UserSystem"."User" ("Id") ON DELETE CASCADE ON UPDATE CASCADE
Steps To Reproducesymadmin send-schema
Additional InformationIt tries to create a table which contains a foreign key referencing to another table without creating that table first. Why don't create all tables first and then add constraints?

Also it doesn't recreate schemata, just says that it is does not exist. So I had to create it manually on the second DB to proceed. Not sure if this is a bug or just not supported.
Tagsddl/schema, dialect: postgresql, initial/partial load

Relationships

related to 0003952 closedpmarzullo Order table creation by foreign key dependency 

Activities

pmarzullo

2023-03-13 17:20

developer   ~0002293

symadmin send-schema - sent schema without foreign key definitions, then if not requested to exclude foreign key definitions, sent schema with foreign. key definitions
Same for GUI.

Related Changesets

SymmetricDS: 3.14 6c8f235c

2023-03-13 17:18:12

pmarzullo

Details Diff
0005722: Tries to create foreign key before creating the referenced
table
Affected Issues
0005722
mod - symmetric-client/src/main/java/org/jumpmind/symmetric/SymmetricAdmin.java Diff File

Issue History

Date Modified Username Field Change
2023-03-03 19:05 umssoft New Issue
2023-03-03 19:05 umssoft Tag Attached: ddl/schema
2023-03-03 19:05 umssoft Tag Attached: dialect: postgresql
2023-03-03 19:05 umssoft Tag Attached: initial/partial load
2023-03-13 12:52 pmarzullo Assigned To => pmarzullo
2023-03-13 12:52 pmarzullo Status new => assigned
2023-03-13 12:52 pmarzullo Target Version => 3.14.6
2023-03-13 17:20 pmarzullo Status assigned => resolved
2023-03-13 17:20 pmarzullo Resolution open => fixed
2023-03-13 17:20 pmarzullo Fixed in Version => 3.14.6
2023-03-13 17:20 pmarzullo Note Added: 0002293
2023-03-13 18:00 pmarzullo Changeset attached => SymmetricDS 3.14 6c8f235c
2023-03-14 14:53 elong Relationship added related to 0003952
2023-03-17 17:25 admin Status resolved => closed