{"record":{"id":"9aeda5d547be98fd","repo":"golang-migrate/migrate","slug":"s-migrationstable-contains-too-many-dot-charact","errorCode":null,"errorMessage":"\"%s\" MigrationsTable contains too many dot characters","messagePattern":"\"(.+?)\" MigrationsTable contains too many dot characters","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"database/pgx/pgx.go","lineNumber":136,"sourceCode":"\n\tif len(config.LockTable) == 0 {\n\t\tconfig.LockTable = DefaultLockTable\n\t}\n\n\tif len(config.LockStrategy) == 0 {\n\t\tconfig.LockStrategy = DefaultLockStrategy\n\t}\n\n\tconfig.migrationsSchemaName = config.SchemaName\n\tconfig.migrationsTableName = config.MigrationsTable\n\tif config.MigrationsTableQuoted {\n\t\tre := regexp.MustCompile(`\"(.*?)\"`)\n\t\tresult := re.FindAllStringSubmatch(config.MigrationsTable, -1)\n\t\tconfig.migrationsTableName = result[len(result)-1][1]\n\t\tif len(result) == 2 {\n\t\t\tconfig.migrationsSchemaName = result[0][1]\n\t\t} else if len(result) > 2 {\n\t\t\treturn nil, fmt.Errorf(\"\\\"%s\\\" MigrationsTable contains too many dot characters\", config.MigrationsTable)\n\t\t}\n\t}\n\n\tconn, err := instance.Conn(context.Background())\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpx := &Postgres{\n\t\tconn:   conn,\n\t\tdb:     instance,\n\t\tconfig: config,\n\t}\n\n\tif err := px.ensureLockTable(); err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/database/pgx/pgx.go#L118-L154","documentation":"When MigrationsTableQuoted is true, the pgx driver expects MigrationsTable to contain one or two quoted identifiers: \"table\" or \"schema\".\"table\". The regex captures each quoted segment; if it finds more than two (i.e. more than one dot-separated quoted pair), WithInstance rejects the value because a table identifier can have at most schema.table components.","triggerScenarios":"Calling pgx.WithInstance (or Open, which calls it) with config.MigrationsTableQuoted = true and a MigrationsTable containing three or more quoted parts, e.g. \"db\".\"public\".\"migrations\", or stray quotes like \"a\".\"b\".\"c\" (database/pgx/pgx.go:129-137).","commonSituations":"Copying a fully-qualified three-part identifier (database.schema.table) from SQL Server style conventions into Postgres config; double-quoting each dot segment; templating that wraps the whole value plus parts in quotes.","solutions":["Use at most two parts: \"schema_name\".\"table_name\" (or just \"table_name\") for MigrationsTable","Drop MigrationsTableQuoted (leave false) if you don't actually need quoted/case-sensitive identifiers","Remove any database/catalog part — Postgres identifiers are limited to schema.table"],"exampleFix":"// before\ncfg.MigrationsTable = \"\\\"app\\\".\\\"public\\\".\\\"schema_migrations\\\"\"; cfg.MigrationsTableQuoted = true\n// after\ncfg.MigrationsTable = \"\\\"public\\\".\\\"schema_migrations\\\"\"; cfg.MigrationsTableQuoted = true","handlingStrategy":"validation","validationCode":"func validateMigrationsTable(cfg *pgx.Config) error {\n    if !cfg.MigrationsTableQuoted {\n        return nil\n    }\n    re := regexp.MustCompile(`\"([^\"]+)\"`)\n    if n := len(re.FindAllStringSubmatch(cfg.MigrationsTable, -1)); n > 2 {\n        return fmt.Errorf(\"MigrationsTable %q has %d quoted parts; max is schema.table (2)\", cfg.MigrationsTable, n)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"drv, err := pgx.WithInstance(db, cfg)\nif err != nil && strings.Contains(err.Error(), \"contains too many dot characters\") {\n    return fmt.Errorf(\"quoted MigrationsTable must be \\\"schema\\\".\\\"table\\\" or \\\"table\\\": %w\", err)\n}","preventionTips":["Remember Postgres identifiers are schema.table at most — never include a database/catalog part","Only enable MigrationsTableQuoted for genuinely case-sensitive or reserved-word identifiers","Test quoted-identifier config with the actual Postgres version before rollout"],"tags":["postgres","pgx","configuration","identifier-parsing","migrations-table"],"backgroundTag":"invalid-identifier-format","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}