View Issue Details

IDProjectCategoryView StatusLast Update
0005723SymmetricDSBugpublic2023-03-13 17:00
Reporterumssoft Assigned Toemiller  
Priorityurgent 
Status closedResolutionfixed 
Product Version3.14.5 
Target Version3.14.6Fixed in Version3.14.6 
Summary0005723: The schema of the table that is being created is used instead of correct one when creating a foreign key
Description2023-03-04 02:25:01,406 INFO [kiosk-001] [DefaultDatabaseWriter] [kiosk-001-dataloader-20] 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="UserPersonalServiceAccess">
        <column name="Id" primaryKey="true" primaryKeySeq="1" required="true" type="INTEGER" size="10" autoIncrement="true">
            <platform-column name="postgres95" type="int4" size="10"/>
        </column>
        <column name="ServiceGuid" required="true" type="LONGVARCHAR" size="2147483647">
            <platform-column name="postgres95" type="uuid" size="2147483647"/>
        </column>
        <column name="HasAccess" type="BIT" size="1">
            <platform-column name="postgres95" type="bool" size="1"/>
        </column>
        <column name="UserGuid" required="true" type="LONGVARCHAR" size="2147483647">
            <platform-column name="postgres95" type="uuid" size="2147483647"/>
        </column>
        <foreign-key name="RecordOwnerService_ServiceGuid_fk" foreignTable="Service" foreignTableCatalog="" foreignTableSchema="" foreignOnUpdateAction="CASCADE" foreignOnDeleteAction="CASCADE">
            <reference local="ServiceGuid" foreign="Guid"/>
        </foreign-key>
        <foreign-key name="UserPersonalServiceAccess_UserGuid_fk" foreignTable="User" foreignTableCatalog="" foreignTableSchema="" foreignOnUpdateAction="CASCADE" foreignOnDeleteAction="CASCADE">
            <reference local="UserGuid" foreign="Guid"/>
        </foreign-key>
    </table>
</database>
2023-03-04 02:25:01,422 INFO [kiosk-001] [PostgreSql95DatabasePlatform] [kiosk-001-dataloader-20] Running alter sql:
ALTER TABLE "UserSystem"."UserPersonalServiceAccess"
    ADD CONSTRAINT "RecordOwnerService_ServiceGuid_fk" FOREIGN KEY ("ServiceGuid") REFERENCES "UserSystem"."Service" ("Guid") ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE "UserSystem"."UserPersonalServiceAccess"
    ADD CONSTRAINT "UserPersonalServiceAccess_UserGuid_fk" FOREIGN KEY ("UserGuid") REFERENCES "UserSystem"."User" ("Guid") ON DELETE CASCADE ON UPDATE CASCADE;

2023-03-04 02:25:01,422 WARN [kiosk-001] [JdbcSqlTemplate] [kiosk-001-dataloader-20] ОШИБКА: отношение "UserSystem.Service" не существует. Failed to execute: ALTER TABLE "UserSystem"."UserPersonalServiceAccess"
    ADD CONSTRAINT "RecordOwnerService_ServiceGuid_fk" FOREIGN KEY ("ServiceGuid") REFERENCES "UserSystem"."Service" ("Guid") ON DELETE CASCADE ON UPDATE CASCADE
Additional InformationOf course "UserSystem"."Service" doesn't exist, because this foreign key originaly references to "Service"."Service" in the source database.

FOREIGN KEY ("ServiceGuid")
    REFERENCES "Service"."Service"("Guid")
    ON DELETE CASCADE
    ON UPDATE CASCADE
    NOT DEFERRABLE
Tagsdialect: postgresql

Activities

umssoft

2023-03-06 05:48

reporter   ~0002283

What your thing tries to do:
ALTER TABLE "Record"."Record"
    ADD CONSTRAINT "Record_DocumentGuid_fk" FOREIGN KEY ("DocumentGuid") REFERENCES "Record"."Document" ("Guid");

2023-03-06 12:43:39,391 WARN [kiosk-001] [JdbcSqlTemplate] [kiosk-001-dataloader-35] ОШИБКА: отношение "Record.Document" не существует. Failed to execute: ALTER TABLE "Record"."Record"
    ADD CONSTRAINT "Record_DocumentGuid_fk" FOREIGN KEY ("DocumentGuid") REFERENCES "Record"."Document" ("Guid")

What it should do:
    REFERENCES "Document"."Document"("Guid")

Why?

umssoft

2023-03-06 05:56

reporter   ~0002284

Maybe that's because I have use_source_catalog_schema enabled on the router? But it just tries to put everything in public schema if I don't enable it

Related Changesets

SymmetricDS: 3.14 a9dfff13

2023-03-13 16:54:06

evan-miller-jumpmind

Details Diff
0005723: Fixed blank foreignTableSchema when exporting Postgres FKs to XML Affected Issues
0005723
mod - symmetric-jdbc/src/main/java/org/jumpmind/db/platform/postgresql/PostgreSqlDdlReader.java Diff File

Issue History

Date Modified Username Field Change
2023-03-03 19:58 umssoft New Issue
2023-03-03 19:58 umssoft Tag Attached: dialect: postgresql
2023-03-06 05:48 umssoft Note Added: 0002283
2023-03-06 05:56 umssoft Note Added: 0002284
2023-03-13 16:29 emiller Assigned To => emiller
2023-03-13 16:29 emiller Status new => assigned
2023-03-13 16:56 emiller Status assigned => resolved
2023-03-13 16:56 emiller Resolution open => fixed
2023-03-13 16:56 emiller Fixed in Version => 3.14.6
2023-03-13 16:56 emiller Target Version => 3.14.6
2023-03-13 17:00 Changeset attached => SymmetricDS 3.14 a9dfff13
2023-03-17 17:25 admin Status resolved => closed