Skip to content

Support Postgres custom type #55

Description

@zhenwenc

Recently have a requirement on using custom Enum type on Postgres database, but when I trying to insert test data with DbSetup, the following exception thrown:

Cause: org.postgresql.util.PSQLException: ERROR: column "animal_type" is of type currency but expression is of type character varying

The reason is that, to insert data with JDBC prepared statement, the query needs to be in form:
INSERT INTO pet (pet_id, pet_type, name) VALUES (?, ?::animal_type, ?);

Please refer this site for more details: http://www.gotoquiz.com/web-coding/programming/java-programming/convert-between-java-enums-and-postgresql-enums/

By digging into the source code, the only way I found to solve this problem is hacking the Insert#execute method (

)

I am wondering, is there any other convenient way to achieve this?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions