gnormal / gnorm

A database-first code generator for any language
https://gnorm.org
Other
487 stars 40 forks source link

gnorm do not recognize default value from identity #120

Open deelienardy opened 5 years ago

deelienardy commented 5 years ago

DB: Postgres v11.3 ubuntu

i try using gnorm for generate custom query builder for my project but when i try separating PK which has default value or not (such as custom PK by app or default using UUID), error happens.

It happens when i create table, like:

CREATE TABLE "test" ("id" BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY NOT NULL)

gnorm preview showing PK no default value

+------+--------+------+--------+---------+--------------+-------+----------+--------+-------------+----------+------------+---------+
| Name | DBName | Type | DBType | IsArray | IsPrimaryKey | IsFK  | HasFKRef | Length | UserDefined | Nullable | HasDefault | Comment |
+------+--------+------+--------+---------+--------------+-------+----------+--------+-------------+----------+------------+---------+
| id   | id     | int  | bigint | false   | true         | false | false    |      0 | false       | false    | false      |         |
+------+--------+------+--------+---------+--------------+-------+----------+--------+-------------+----------+------------+---------+

but on psql showing PK has default value

+--------+--------+-----------+----------+------------------------------+
| Column |  Type  | Collation | Nullable | Default                      |
|--------|--------|-----------|----------|------------------------------|
| id     | bigint |           | not null | generated always as identity |
+--------+--------+-----------+----------+------------------------------+

is this error from my config or gnorm do not recognize generated always as identity ?