{"record":{"id":"90255da8b84bb314","repo":"ory/hydra","slug":"dsn-scheme-postgres-declares-a-postgresql-datab-90255d","errorCode":null,"errorMessage":"DSN scheme postgres:// declares a PostgreSQL database but the server is YugabyteDB. Replace the scheme with yugabyte:// (supported in Ory Enterprise License builds) so that the service picks the correct migrations and SQL dialect. Server reported: %q.","messagePattern":"DSN scheme postgres:// declares a PostgreSQL database but the server is YugabyteDB\\. Replace the scheme with yugabyte:// \\(supported in Ory Enterprise License builds\\) so that the service picks the correct migrations and SQL dialect\\. Server reported: %q\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"oryx/popx/dialect_check.go","lineNumber":65,"sourceCode":"\tdetectedYugabyte := strings.Contains(version, yugabyteVersionMarker)\n\tswitch {\n\tcase declared == dbal.DriverCockroachDB && !detectedCockroach:\n\t\treturn errors.Errorf(\n\t\t\t\"DSN scheme cockroach:// declares a CockroachDB database but the server is not CockroachDB. Server reported: %q. Use a postgres:// DSN, or point the service at a CockroachDB cluster.\",\n\t\t\tfirstLine(version),\n\t\t)\n\tcase declared == dbal.DriverYugabyteDB && !detectedYugabyte:\n\t\treturn errors.Errorf(\n\t\t\t\"DSN scheme yugabyte:// declares a YugabyteDB database but the server is not YugabyteDB. Server reported: %q. Use a DSN scheme matching the actual server, or point the service at a YugabyteDB cluster.\",\n\t\t\tfirstLine(version),\n\t\t)\n\tcase declared == namePostgres && detectedCockroach:\n\t\treturn errors.Errorf(\n\t\t\t\"DSN scheme postgres:// declares a PostgreSQL database but the server is CockroachDB. Replace the scheme with cockroach:// so that the service picks the correct migrations and SQL dialect. Server reported: %q\",\n\t\t\tfirstLine(version),\n\t\t)\n\tcase declared == namePostgres && detectedYugabyte && yugabyteDialectSupported:\n\t\treturn errors.Errorf(\n\t\t\t\"DSN scheme postgres:// declares a PostgreSQL database but the server is YugabyteDB. Replace the scheme with yugabyte:// (supported in Ory Enterprise License builds) so that the service picks the correct migrations. Server reported: %q\",\n\t\t\tfirstLine(version),\n\t\t)\n\t}\n\treturn nil\n}\n\nfunc firstLine(s string) string {\n\tif i := strings.IndexByte(s, '\\n'); i >= 0 {\n\t\treturn s[:i]\n\t}\n\treturn s\n}\n","sourceCodeStart":47,"sourceCodeEnd":79,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/popx/dialect_check.go#L47-L79","documentation":"YugabyteDB also speaks the Postgres wire protocol, so a postgres:// DSN can silently connect to a YugabyteDB server. checkDialect (oryx/popx/dialect_check.go:64) detects the \"-YB-\" marker in version() and throws this error so the yugabyte:// scheme is used, which selects YugabyteDB-specific migrations. YugabyteDB support is only available in Ory Enterprise License builds (yugabyteDialectSupported).","triggerScenarios":"Calling VerifyDialect(ctx, conn) where the DSN scheme is postgres:// but version() contains the \"-YB-\" YugabyteDB marker, and pop.DialectSupported(dbal.DriverYugabyteDB) is true.","commonSituations":"Pointing a service at a YugabyteDB cluster using a Postgres DSN left over from a previous setup; enabling YugabyteDB in an enterprise build but not updating the scheme; test environments provisioned with YugabyteDB instead of Postgres.","solutions":["Replace the postgres:// scheme with yugabyte:// in the DSN (requires an Ory Enterprise License build)","If you do not have an enterprise license, point the service at a real PostgreSQL server","Confirm the target server with SELECT version(); if YugabyteDB was provisioned by mistake, switch to Postgres"],"exampleFix":"// before\nDSN=postgres://user:pass@yb-host:5433/yugabyte\n// after\nDSN=yugabyte://user:pass@yb-host:5433/yugabyte","handlingStrategy":"validation","validationCode":"var version string\nif err := conn.RawQuery(\"SELECT version()\").First(&version); err != nil { return err }\nif strings.Contains(version, \"-YB-\") && conn.Dialect.Name() == \"postgres\" {\n    return errors.New(\"DSN scheme must be yugabyte:// (enterprise build) for YugabyteDB\")\n}","typeGuard":null,"tryCatchPattern":"if err := popx.VerifyDialect(ctx, conn); err != nil {\n    log.Fatalf(\"dialect verification failed: %v\", err)\n}","preventionTips":["Only use yugabyte:// in Ory Enterprise License builds; otherwise never point at YugabyteDB","Run VerifyDialect at startup to catch scheme/server mismatches","Keep YugabyteDB and Postgres DSNs in separate, clearly labeled configuration entries"],"tags":["database","dsn","yugabytedb","postgresql","config"],"backgroundTag":"dsn-dialect-mismatch","analyzedSha":"4174065ffb052799890f7480f5360a877a67ffc1","analyzedAt":"2026-09-03T14:52:41.581Z","contentChangedAt":"2026-09-03T14:52:41.581Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}