{"record":{"id":"dfa1ea941d91d5fa","repo":"OtterMind/Chat2DB","slug":"invalid-postgresql-what-value","errorCode":null,"errorMessage":"Invalid PostgreSQL ${what}: ${value}","messagePattern":"Invalid PostgreSQL (.+?): (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"chat2db-community-server/chat2db-community-plugins/chat2db-community-postgresql/src/main/java/ai/chat2db/plugin/postgresql/PostgreSqlGuards.java","lineNumber":42,"sourceCode":"            \"DROP\", \"ALTER\", \"CREATE\", \"GRANT\", \"REVOKE\", \"TRUNCATE\");\n    private static final Set<String> TYPE_BREAKOUT_KEYWORDS = Set.of(\n            \"CHECK\", \"COLLATE\", \"CONSTRAINT\", \"DEFAULT\", \"GENERATED\", \"NOT\", \"NULL\",\n            \"PRIMARY\", \"REFERENCES\", \"UNIQUE\");\n    private static final Set<String> PRIVILEGES = Set.of(\n            \"SELECT\", \"INSERT\", \"UPDATE\", \"DELETE\", \"TRUNCATE\", \"REFERENCES\", \"TRIGGER\", \"MAINTAIN\");\n    private static final Set<String> VIEW_STORAGE_CLAUSES = Set.of(\n            \"TEMP\", \"LOCAL TEMP\", \"GLOBAL TEMP\", \"UNLOGGED\");\n\n    private PostgreSqlGuards() {\n    }\n\n    /**\n     * Validate a strict PostgreSQL name token (index method / role / keyword-style positions where\n     * escaping is impossible by design).\n     */\n    public static String requirePgName(String value, String what) {\n        if (value == null || !PG_NAME_PATTERN.matcher(value).matches()) {\n            throw new IllegalArgumentException(\"Invalid PostgreSQL \" + what + \": \" + value);\n        }\n        return value;\n    }\n\n    /**\n     * Validates one quote-aware PostgreSQL DEFAULT expression. Function calls, casts, sequence\n     * expressions, array subscripts, dollar-quoted strings, and nested parentheses are preserved,\n     * while statement terminators, comments, unbalanced delimiters, top-level commas, and column\n     * constraint suffixes are rejected.\n     */\n    public static String requireDefaultExpression(String value) {\n        if (StringUtils.isBlank(value)) {\n            throw invalid(\"default value\", value);\n        }\n        String expression = value.trim();\n        scanDefaultExpression(expression);\n        return expression;\n    }","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-plugins/chat2db-community-postgresql/src/main/java/ai/chat2db/plugin/postgresql/PostgreSqlGuards.java#L24-L60","documentation":"Error \"Invalid PostgreSQL ${what}: ${value}\" thrown in OtterMind/Chat2DB.","triggerScenarios":"A PostgreSQL DDL element failed guard validation.","commonSituations":"See trigger scenarios.","solutions":["Correct the invalid PostgreSQL element named in the message to an allowed value."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}