MCPcopy Create free account
hub / github.com/lib/pq / Error

Struct Error

error.go:33–109  ·  view source on GitHub ↗

Error returned by the PostgreSQL server. The [Error] method returns the error message and error code: pq: invalid input syntax for type json (22P02) The [ErrorWithDetail] method also includes the error Detail, Hint, and location context (if any): ERROR: invalid input syntax for type json (22

Source from the content-addressed store, hash-verified

31// 5 | 'foo', 'asd'::jsonb
32// ^
33type Error struct {
34 // [Efatal], [Epanic], [Ewarning], [Enotice], [Edebug], [Einfo], or [Elog].
35 // Always present.
36 Severity string
37
38 // SQLSTATE code. Always present.
39 Code pqerror.Code
40
41 // Primary human-readable error message. This should be accurate but terse
42 // (typically one line). Always present.
43 Message string
44
45 // Optional secondary error message carrying more detail about the problem.
46 // Might run to multiple lines.
47 Detail string
48
49 // Optional suggestion what to do about the problem. This is intended to
50 // differ from Detail in that it offers advice (potentially inappropriate)
51 // rather than hard facts. Might run to multiple lines.
52 Hint string
53
54 // error position as an index into the original query string, as decimal
55 // ASCII integer. The first character has index 1, and positions are
56 // measured in characters not bytes.
57 Position string
58
59 // This is defined the same as the Position field, but it is used when the
60 // cursor position refers to an internally generated command rather than the
61 // one submitted by the client. The InternalQuery field will always appear
62 // when this field appears.
63 InternalPosition string
64
65 // Text of a failed internally-generated command. This could be, for
66 // example, an SQL query issued by a PL/pgSQL function.
67 InternalQuery string
68
69 // An indication of the context in which the error occurred. Presently this
70 // includes a call stack traceback of active procedural language functions
71 // and internally-generated queries. The trace is one entry per line, most
72 // recent first.
73 Where string
74
75 // If the error was associated with a specific database object, the name of
76 // the schema containing that object, if any.
77 Schema string
78
79 // If the error was associated with a specific table, the name of the table.
80 // (Refer to the schema name field for the name of the table's schema.)
81 Table string
82
83 // If the error was associated with a specific table column, the name of the
84 // column. (Refer to the schema and table name fields to identify the
85 // table.)
86 Column string
87
88 // If the error was associated with a specific data type, the name of the
89 // data type. (Refer to the schema name field for the name of the data
90 // type's schema.)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected