{"record":{"id":"31c08a2352a8dbda","repo":"jackc/pgx","slug":"stmt-query-deprecated-and-not-implemented","errorCode":null,"errorMessage":"Stmt.Query deprecated and not implemented","messagePattern":"Stmt\\.Query deprecated and not implemented","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"stdlib/sql.go","lineNumber":620,"sourceCode":"\t}\n\n\treturn s.conn.conn.Deallocate(ctx, s.sd.SQL)\n}\n\nfunc (s *Stmt) NumInput() int {\n\treturn len(s.sd.ParamOIDs)\n}\n\nfunc (s *Stmt) Exec(argsV []driver.Value) (driver.Result, error) {\n\treturn nil, errors.New(\"Stmt.Exec deprecated and not implemented\")\n}\n\nfunc (s *Stmt) ExecContext(ctx context.Context, argsV []driver.NamedValue) (driver.Result, error) {\n\treturn s.conn.ExecContext(ctx, s.sd.SQL, argsV)\n}\n\nfunc (s *Stmt) Query(argsV []driver.Value) (driver.Rows, error) {\n\treturn nil, errors.New(\"Stmt.Query deprecated and not implemented\")\n}\n\nfunc (s *Stmt) QueryContext(ctx context.Context, argsV []driver.NamedValue) (driver.Rows, error) {\n\treturn s.conn.QueryContext(ctx, s.sd.SQL, argsV)\n}\n\ntype rowValueFunc func(src []byte) (driver.Value, error)\n\ntype Rows struct {\n\tconn         *Conn\n\trows         pgx.Rows\n\tvalueFuncs   []rowValueFunc\n\tskipNext     bool\n\tskipNextMore bool\n\n\tcolumnNames []string\n}\n","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/stdlib/sql.go#L602-L638","documentation":"stdlib Stmt.Query implements database/sql's deprecated single-round-trip Query hook, which pgx deliberately does not support and always errors on. Standard database/sql code paths call QueryContext instead; reaching this error means a legacy driver-level call.","triggerScenarios":"Thrown at stdlib/sql.go:620 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call QueryContext via database/sql rather than the deprecated driver.Stmt hook","Use pgx directly for statement-oriented APIs"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}