View Issue Details

IDProjectCategoryView StatusLast Update
0001758SymmetricDSBugpublic2014-07-12 21:31
Reportertregnago Assigned Tochenson  
Prioritynormal 
Status closedResolutionfixed 
Product Version3.5.22 
Target Version3.6.2Fixed in Version3.6.2 
Summary0001758: PostgreSQL default value for 'uuid' field type
DescriptionSqlException happens with initial.load.create.first=true with PostgreSQL, using uuid data types.
Steps To ReproduceOriginal table has an uuid column type with a default value of 'deadbeef-badd-badd-badd-2be2def4bedd'::uuid.

CREATE TABLE sys_ruoli
(
  idruolo uuid NOT NULL DEFAULT uuid_generate_v4(),
  ruolo character varying(50) NOT NULL,
  descrizione character varying(100) NOT NULL,
  immagine bytea,
  incarico boolean NOT NULL,
  inserimento timestamp(3) without time zone NOT NULL DEFAULT now(),
  idrecordwriter uuid NOT NULL DEFAULT 'deadbeef-badd-badd-badd-2be2def4bedd'::uuid,
  CONSTRAINT pk_sys_ruoli PRIMARY KEY (idruolo)
)
Additional InformationServer generates this:
<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database">
<database name="public">
    <table name="sys_ruoli">
        <column name="idruolo" primaryKey="true" required="true" type="OTHER" size="2147483647" default="uuid_generate_v4()">
            <platform-column name="postgres" type="uuid" size="2147483647"/>
        </column>
        <column name="ruolo" required="true" type="VARCHAR" size="50">
            <platform-column name="postgres" type="varchar" size="50"/>
        </column>
        <column name="descrizione" required="true" type="VARCHAR" size="100">
            <platform-column name="postgres" type="varchar" size="100"/>
        </column>
        <column name="immagine" type="LONGVARBINARY" size="2147483647">
            <platform-column name="postgres" type="bytea" size="2147483647"/>
        </column>
        <column name="incarico" required="true" type="BIT" size="1">
            <platform-column name="postgres" type="bool" size="1"/>
        </column>
        <column name="inserimento" required="true" type="TIMESTAMP" size="26,3" default="now()">
            <platform-column name="postgres" type="timestamp" size="26" decimalDigits="3"/>
        </column>
        <column name="idrecordwriter" required="true" type="OTHER" size="2147483647" default="'deadbeef-badd-badd-badd-2be2def4bedd'::uuid">
            <platform-column name="postgres" type="uuid" size="2147483647"/>
        </column>
    </table>
</database>

And the client try to create the table with the following invalid syntax:
CREATE TABLE "sys_ruoli"
(
    "idruolo" uuid DEFAULT 'uuid_generate_v4()' NOT NULL,
    "ruolo" varchar(50) NOT NULL,
    "descrizione" varchar(100) NOT NULL,
    "immagine" bytea,
    "incarico" bool NOT NULL,
    "inserimento" timestamp DEFAULT 'now()' NOT NULL,
    "idrecordwriter" uuid DEFAULT '\'deadbeef-badd-badd-badd-2be2def4bedd\'::uuid' NOT NULL,
    PRIMARY KEY ("idruolo")
);

which result in a syntax error.
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Related Changesets

SymmetricDS: master 2edf269f

2014-07-08 08:11:03

chenson

Details Diff
0001758: PostgreSQL default value for 'uuid' field type Affected Issues
0001758
mod - symmetric-db/src/main/java/org/jumpmind/db/platform/postgresql/PostgreSqlDdlBuilder.java Diff File

Issue History

Date Modified Username Field Change
2014-06-11 14:32 tregnago New Issue
2014-07-08 00:30 chenson Assigned To => chenson
2014-07-08 00:30 chenson Status new => assigned
2014-07-08 00:30 chenson Target Version => 3.6.2
2014-07-08 12:11 chenson Status assigned => resolved
2014-07-08 12:11 chenson Fixed in Version => 3.6.2
2014-07-08 12:11 chenson Resolution open => fixed
2014-07-08 13:00 chenson Changeset attached => SymmetricDS trunk r8444
2014-07-12 21:31 chenson Status resolved => closed
2015-07-31 01:49 chenson Changeset attached => SymmetricDS master 2edf269f