{"record":{"id":"353bf73afffa1f2c","repo":"FlowiseAI/Flowise","slug":"invalid-table-name-353bf7","errorCode":null,"errorMessage":"Invalid table name","messagePattern":"Invalid table name","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Postgres/driver/Base.ts","lineNumber":60,"sourceCode":"\n    getTablePath() {\n        const schemaName = this.getSchemaName()\n        const tableName = this.getTableName()\n        if (!schemaName) return `\"${tableName}\"`\n        return `\"${schemaName}\".\"${tableName}\"`\n    }\n\n    getEmbeddings() {\n        return this.nodeData.inputs?.embeddings as Embeddings\n    }\n\n    sanitizeTableName(tableName: string): string {\n        // Trim and normalize case, turn whitespace into underscores\n        tableName = tableName.trim().toLowerCase().replace(/\\s+/g, '_')\n\n        // Validate using a regex (alphanumeric and underscores only)\n        if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {\n            throw new Error('Invalid table name')\n        }\n\n        return tableName\n    }\n\n    async getCredentials() {\n        const credentialData = await getCredentialData(this.nodeData.credential ?? '', this.options)\n        const user = getCredentialParam('user', credentialData, this.nodeData, process.env.POSTGRES_VECTORSTORE_USER)\n        const password = getCredentialParam('password', credentialData, this.nodeData, process.env.POSTGRES_VECTORSTORE_PASSWORD)\n\n        return {\n            user,\n            password\n        }\n    }\n}\n","sourceCodeStart":42,"sourceCodeEnd":77,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Postgres/driver/Base.ts#L42-L77","documentation":"Thrown by `VectorStoreDriver.sanitizeTableName` when, after trimming, lowercasing, and whitespace→underscore normalization, the table name does not match `^[a-zA-Z0-9_]+$`. Only ASCII letters, digits, and underscores are permitted; spaces are pre-normalized but any other punctuation (hyphen, dot, slash, unicode) fails validation.","triggerScenarios":"User supplies a table name containing hyphens (e.g. `my-docs`), dots (`schema.table`), slashes, parentheses, or non-ASCII characters. Schema-qualified input here also fails because the dot is rejected.","commonSituations":"Default table name templated from a node label that includes spaces or hyphens; copy-paste of a fully-qualified `schema.table` into the table-name field (schema goes in a separate field); unicode in non-English workspace names.","solutions":["Use a table name with only letters, digits, and underscores (e.g. `my_docs`).","Move any schema qualifier into the dedicated schema-name field, not the table name.","Pre-sanitize generated names (strip/replace non-word characters) before passing them in.","Avoid leading digits if you also want broad compatibility (regex allows them but some tools do not)."],"exampleFix":"// before — input 'my-docs' or 'public.docs' fails\nconst name = nodeData.inputs?.tableName // 'my-docs'\n// after — sanitize at the source\nconst raw = (nodeData.inputs?.tableName ?? 'documents').trim()\nconst name = raw.toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'documents'","handlingStrategy":"validation","validationCode":"function sanitizeName(raw: string, fallback = 'documents'): string {\n  const n = raw.trim().toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '')\n  if (!/^[a-z0-9_]+$/.test(n)) return fallback\n  return n\n}","typeGuard":"function isValidTableName(name: string): boolean {\n  return /^[a-zA-Z0-9_]+$/.test(name.trim().toLowerCase().replace(/\\s+/g, '_'))\n}","tryCatchPattern":"const safe = sanitizeName(rawTableName)\nif (!isValidTableName(safe)) throw new Error(`Refusing invalid table name: '${rawTableName}'`)\nnodeData.inputs.tableName = safe","preventionTips":["Restrict table names to letters, digits, and underscores.","Put schema qualifiers in the schema field, not the table name.","Pre-sanitize any templated/generated names.","Validate names at the UI boundary before they reach the driver."],"tags":["postgres","validation","table-name","sanitization"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}