OpenAPITools/openapi-generator · error · RuntimeException
Empty database/table/column name for property '{name}' not a
Error message
Empty database/table/column name for property '{name}' not allowed What it means
PostgresqlSchemaCodegen sanitizes database/table/column identifiers derived from the spec (removing characters illegal in PostgreSQL identifiers, trimming trailing spaces). Names that become empty after sanitization are fatal: escapePostgresqlIdentifier throws 'Empty database/table/column name ... not allowed' (PostgresqlSchemaCodegen.java:1335). Names that are all digits or end with spaces are only warned about and repaired; total emptiness cannot be repaired.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PostgresqlSchemaCodegen.java:1335
*/
public String toPostgresqlIdentifier(String name, String prefix, String suffix) {
String escapedName = escapePostgresqlQuotedIdentifier(name);
// Database, table, and column names cannot end with space characters.
if (escapedName.matches(".*\\s$")) {
LOGGER.warn("Database, table, and column names cannot end with space characters. Check '{}' name", name);
escapedName = escapedName.replaceAll("\\s+$", "");
}
// Identifiers may begin with a digit but unless quoted may not consist solely
// of digits.
if (escapedName.matches("^\\d+$")) {
LOGGER.warn("Database, table, and column names cannot consist solely of digits. Check '{}' name", name);
escapedName = prefix + escapedName + suffix;
}
// identifier name cannot be empty
if (escapedName.isEmpty()) {
throw new RuntimeException("Empty database/table/column name for property '" + name + "' not allowed");
}
return escapedName;
}
/**
* Escapes PostgreSQL identifier to use it in SQL statements without backticks,
* eg. SELECT identifier FROM
*
* @param identifier source identifier
* @return escaped identifier
*/
public String escapePostgresqlUnquotedIdentifier(String identifier) {
// ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore)
// Extended: U+0080 .. U+FFFF
Pattern regexp = Pattern.compile("[^0-9a-zA-z$_\\u0080-\\uFFFF]");
Matcher matcher = regexp.matcher(identifier);
if (matcher.find()) {
LOGGER.warn("Identifier '{}' contains unsafe characters out of [0-9,a-z,A-Z$_] and U+0080..U+FFFF range",View on GitHub (pinned to fcec517be3)
Solutions
- Rename the offending property (its name appears in the message) to a valid identifier.
- Lint the spec for keys containing no alphanumeric characters before running the generator.
- Introduce a preprocessing step mapping symbolic names to safe SQL identifiers if the API keys must stay unchanged.
Example fix
# before (api.yaml)
components:
schemas:
Event:
properties:
"***": { type: string }
# after
components:
schemas:
Event:
properties:
wildcard: { type: string } Defensive patterns
Strategy: validation
Validate before calling
// postgresql: reject keys that sanitize to an empty identifier
Pattern nonWord = Pattern.compile("[^\\w]");
for (var schema : openAPI.getComponents().getSchemas().entrySet()) {
if (schema.getValue().getProperties() == null) continue;
for (String key : schema.getValue().getProperties().keySet()) {
if (nonWord.matcher(key).replaceAll("").isEmpty()) {
throw new IllegalArgumentException(
"Property '" + key + "' sanitizes to an empty PostgreSQL identifier");
}
}
} Try / catch
try {
new DefaultGenerator().opts(clientOptInput).generate();
} catch (RuntimeException e) {
throw new BuildException("PostgreSQL schema generation failed: " + e.getMessage(), e);
} Prevention
- Lint property/schema keys for at least one alphanumeric character.
- Don't reuse display labels or symbols as schema keys in DDL-generating specs.
- Add a preprocessing rename map for unavoidable symbolic keys.
When it happens
Trigger: A spec property/model/schema key (or postgres vendor-extension name) made entirely of characters sanitization strips — e.g. `###`, `$`, `***`, whitespace-only — reaching escapePostgresqlIdentifier() during postgresql schema generation.
Common situations: Symbolic column headers exported from spreadsheets into OpenAPI; placeholder keys left by refactors; specs authored for display (e.g. using symbols as labels) then reused for DDL generation.
Related errors
- Empty database/table/column name for property '{name}' not a
- Empty database/table/column name for property '{name}' not a
- The BLOB, TEXT, GEOMETRY, and JSON data types cannot be assi
- The BLOB and JSON data types cannot be assigned a default va
- The BLOB, TEXT, GEOMETRY, and JSON data types cannot be assi
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/7a47f84bc88abc06.
Report an issue: GitHub.