{"id":"e770aa1f6d1f1b4f","repo":"jackc/pgx","slug":"server-is-not-in-hot-standby-mode","errorCode":null,"errorMessage":"server is not in hot standby mode","messagePattern":"server is not in hot standby mode","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/config.go","lineNumber":1074,"sourceCode":"\t}\n\n\tif string(result[0].Rows[0][0]) != \"on\" {\n\t\treturn errors.New(\"connection is not read only\")\n\t}\n\n\treturn nil\n}\n\n// ValidateConnectTargetSessionAttrsStandby is a ValidateConnectFunc that implements libpq compatible\n// target_session_attrs=standby.\nfunc ValidateConnectTargetSessionAttrsStandby(ctx context.Context, pgConn *PgConn) error {\n\tresult, err := pgConn.Exec(ctx, \"select pg_is_in_recovery()\").ReadAll()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif string(result[0].Rows[0][0]) != \"t\" {\n\t\treturn errors.New(\"server is not in hot standby mode\")\n\t}\n\n\treturn nil\n}\n\n// ValidateConnectTargetSessionAttrsPrimary is a ValidateConnectFunc that implements libpq compatible\n// target_session_attrs=primary.\nfunc ValidateConnectTargetSessionAttrsPrimary(ctx context.Context, pgConn *PgConn) error {\n\tresult, err := pgConn.Exec(ctx, \"select pg_is_in_recovery()\").ReadAll()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif string(result[0].Rows[0][0]) == \"t\" {\n\t\treturn errors.New(\"server is in standby mode\")\n\t}\n\n\treturn nil","sourceCodeStart":1056,"sourceCodeEnd":1092,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/config.go#L1056-L1092","documentation":"Error \"server is not in hot standby mode\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgconn/config.go:1074 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}