Menu

#204 Add support for additional info of columns

(future)
pending
nobody
None
5
2017-12-12
2017-09-20
Axel
No

For example if a column has a type different from standard(string, number, ...) we must be able to add that specific info.

CREATE TYPE PRODUCT AS ENUM ('phone', 'laptop', 'mouse');

CREATE TABLE products (
    id BIGSERIAL NOT NULL PRIMARY KEY,
    title VARCHAR(20) NOT NULL,
    type PRODUCT NOT NULL
);

For example solution could be:

<dataset>
    <products id="1" title="Pixel">
        <column name="type" type="PRODUCT" value="laptop" />
    </products>
</dataset>

Other syntax could be

<dataset>
    <products id="1" title="Pixel" type:Product="laptop" />
</dataset>

Discussion

  • Jeff Jensen

    Jeff Jensen - 2017-09-24

    Ticket moved from /p/dbunit/bugs/403/

    Can't be converted:

    • _fixed_release: (not fixed)
    • _milestone: v2.5.*
     
  • Jeff Jensen

    Jeff Jensen - 2017-10-17

    I'm not understanding why we would want to mimic DDL/table config in dbUnit. The dbUnit tables are representing data for insert or comparison.

     
  • Jeff Jensen

    Jeff Jensen - 2017-10-17
    • status: open --> pending
    • Release: v2.5.* --> (future)
     
  • Rader Io

    Rader Io - 2017-11-14

    Hi,
    but how you will know how to insert data, as VARCHAR or as PRODUCT type?
    because https://gist.github.com/anonymous/01e3fd902271d713cff22ce35de084d6
    throw exception

    Exception in thread "main" org.dbunit.DatabaseUnitException: Exception processing table name='products'
    at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:240)
    at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
    at org.dbunit.AbstractDatabaseTester.executeOperation(AbstractDatabaseTester.java:199)
    at org.dbunit.AbstractDatabaseTester.onSetup(AbstractDatabaseTester.java:109)
    Caused by: org.postgresql.util.PSQLException: ERROR: column "type" is of type product but expression is of type character varying
    Hint: You will need to rewrite or cast the expression.

     
  • Rader Io

    Rader Io - 2017-12-12

    Any news about this issue?

     
    • Jeff Jensen

      Jeff Jensen - 2017-12-12

      Instead of changing the dataset, can dbUnit use the metadata to automatically determine the correct insert statement?

      I suggest reviewing PostgresqlDataTypeFactory and processing around it to see if you can make something work.

       
Monday.com Logo