Open
Description
Why not use identity for serial .
The serial in the PostgreSQl wiki is marked as anti pattern also,
The serial types have some weird behaviors that make schema, dependency, and permission management unnecessarily cumbersome.
Describe the solution you'd like
openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PostgresqlSchemaCodegen.java
Line 53, 54
Block ine 525-550 change the logic to use identity
Something like this
if (colName.equals("id") && Boolean.valueOf(additionalProperties.get(ID_AUTOINC_ENABLED).toString())) {
columnDefinition.put("colDataType", "BIGINT GENERATED ALWAYS AS IDENTITY");
} else {
columnDefinition.put("colDataType", "BIGINT");
}
---
if (colName.equals("id") && Boolean.valueOf(additionalProperties.get(ID_AUTOINC_ENABLED).toString())) {
if (colDataType.equals("BIGINT")) {
colDataType = "BIGINT GENERATED ALWAYS AS IDENTITY";
}
---
if (!columnDefinition.get("colDataType").equals("BIGINT GENERATED ALWAYS AS IDENTITY")
) { // No default value for autoincremented
// IDs