We’re using postgres 8.3, liquibase 1.9.5 and I’m trying to add a new table that has a foreign key to an ID or type UUID on another table.
Here is the xml for the changeset:
And here is the SQL that is generated and the error details:
Error executing SQL CREATE TABLE metadata.prototype_dataset_version_replica (id CHAR(36) NOT NULL, dataset_version_id CHAR(36) NOT NULL, remote_host_name TEXT NOT NULL, remote_host_city TEXT NOT NULL, remote_host_country TEXT NOT NULL, CONSTRAINT PK_PROTOTYPE_DATASET_VERSION_REPLICA PRIMARY KEY (id), CONSTRAINT fkey_prototype_dataset_version_replica_dataset_version_id FOREIGN KEY (dataset_version_id) REFERENCES metadata.prototype_dataset_version(id)): Caused By: Error executing SQL CREATE TABLE metadata.prototype_dataset_version_replica (id CHAR(36) NOT NULL, dataset_version_id CHAR(36) NOT NULL, remote_host_name TEXT NOT NULL, remote_host_city TEXT NOT NULL, remote_host_country TEXT NOT NULL, CONSTRAINT PK_PROTOTYPE_DATASET_VERSION_REPLICA PRIMARY KEY (id), CONSTRAINT fkey_prototype_dataset_version_replica_dataset_version_id FOREIGN KEY (dataset_version_id) REFERENCES metadata.prototype_dataset_version(id)): Caused By: ERROR: foreign key constraint "fkey_prototype_dataset_version_replica_dataset_version_id" cannot be implemented Detail: Key columns "dataset_version_id" and "id" are of incompatible types: character and uuid.Please notice that I tried to create the id and dataset_version_id columns of type UUID, but in the generated SQL they are being inserted as CHAR(36).
Is there something that I am doing wrong? We do have set as a condition in the changelog.
This issue isn’t critical because we can always write the sql by hand, but I was hoping to use the xml definitions.
Thank you for your time.