{"id":"719913cdf29bbc73","repo":"jackc/pgx","slug":"server-is-in-standby-mode","errorCode":null,"errorMessage":"server is in standby mode","messagePattern":"server is in standby mode","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/config.go","lineNumber":1089,"sourceCode":"\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\n}\n\n// ValidateConnectTargetSessionAttrsPreferStandby is a ValidateConnectFunc that implements libpq compatible\n// target_session_attrs=prefer-standby.\nfunc ValidateConnectTargetSessionAttrsPreferStandby(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 &NotPreferredError{err: errors.New(\"server is not in hot standby mode\")}\n\t}\n\n\treturn nil","sourceCodeStart":1071,"sourceCodeEnd":1107,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/config.go#L1071-L1107","documentation":"Error \"server is in standby mode\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgconn/config.go:1089 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}