huntlabs / hunt-entity

An object-relational mapping (ORM) framework for D language (Similar to JPA / Doctrine), support PostgreSQL and MySQL.

Home Page:https://www.huntlabs.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PostgreSQL syntax errors

ximion opened this issue · comments

Hi!
Give this simple entity:

@Table("users")
class User
{
    mixin MakeEntity;

    @PrimaryKey
    @AutoIncrement
    int id;

    string name;
    double money;
    string email;
    bool status;
}

If I want to create tables for it via entityManagerFactory.createTables!(User); I get this SQL syntax error on PostgreSQL:

2018-08-28T23:53:13.993:statement.d:execute:84 CREATE TABLE users (name TEXT, id INT NOT NULL PRIMARY KEYSERIAL PRIMARY KEY, money FLOAT(53), email TEXT, status BOOLEAN) 
hunt.database.exception.DatabaseException@../subprojects/hunt-database/source/hunt/database/driver/postgresql/connection.d(83): DB SQL : CREATE TABLE users (name TEXT, id INT NOT NULL PRIMARY KEYSERIAL PRIMARY KEY, money FLOAT(53), email TEXT, status BOOLEAN) 
DB status : 7 
EXECUTE ERROR : 7
FEHLER:  Syntaxfehler bei »KEYSERIAL«
LINE 1: ...E TABLE users (name TEXT, id INT NOT NULL PRIMARY KEYSERIAL ...
                                                             ^

It looks like Entity can't handle the Postgres SQL syntax very well at time... (I have never seen KEYSERIAL in SQL...)

thank you for your report . this is hunt-database's bug. now fixed at commit d2b2472