All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sql_postgresql.h
Go to the documentation of this file.
1 /* Copyright 2006 The FreeRADIUS server project */
2 
3 #ifndef _SQL_POSTGRESQL_H_
4 #define _SQL_POSTGRESQL_H_
5 
6 RCSIDH(sql_postgresql_h, "$Id: d90e7f2cf644c962c96719429b9deaae087c6440 $")
7 
8 /** Error Codes and required information
9  *
10  */
11 typedef struct pgsql_error{
12  char const *errorcode; //!< 5 char error code from PG_DIAG_SQLSTATE.
13  char const *meaning; //!< Verbose description.
14  bool reconnect; //!< Should reconnect socket when receiving this error.
15 } pgerror;
16 
17 static pgerror errorcodes[] = {
18  { "0100C", "DYNAMIC RESULT SETS RETURNED", false },
19  { "01008", "IMPLICIT ZERO BIT PADDING", false },
20  { "01003", "NULL VALUE ELIMINATED IN SET FUNCTION", false },
21  { "01007", "PRIVILEGE NOT GRANTED", false },
22  { "01006", "PRIVILEGE NOT REVOKED", false },
23  { "01004", "STRING DATA RIGHT TRUNCATION", false },
24  { "01P01", "DEPRECATED FEATURE", false },
25 
26  { "02000", "NO DATA", false },
27  { "02001", "NO ADDITIONAL DYNAMIC RESULT SETS RETURNED", false },
28 
29  { "03000", "SQL STATEMENT NOT YET COMPLETE", false },
30 
31  { "08000", "CONNECTION EXCEPTION", false },
32  { "08003", "CONNECTION DOES NOT EXIST", false },
33  { "08006", "CONNECTION FAILURE", false },
34  { "08001", "SQLCLIENT UNABLE TO ESTABLISH SQLCONNECTION", false },
35  { "08004", "SQLSERVER REJECTED ESTABLISHMENT OF SQLCONNECTION", false },
36  { "08007", "TRANSACTION RESOLUTION UNKNOWN", false },
37  { "08P01", "PROTOCOL VIOLATION", false },
38 
39  { "9000", "TRIGGERED ACTION EXCEPTION", false },
40 
41  { "0A000", "FEATURE NOT SUPPORTED", false },
42 
43  { "0B000", "INVALID TRANSACTION INITIATION", false },
44 
45  { "0F000", "LOCATOR EXCEPTION", false },
46  { "0F001", "INVALID LOCATOR SPECIFICATION", false },
47 
48  { "0L000", "INVALID GRANTOR", false },
49  { "0LP01", "INVALID GRANT OPERATION", false },
50 
51  { "21000", "CARDINALITY VIOLATION", false },
52 
53  { "22000", "DATA EXCEPTION", false },
54  { "2202E", "ARRAY SUBSCRIPT ERROR", false },
55  { "22021", "CHARACTER NOT IN REPERTOIRE", false },
56  { "22008", "DATETIME FIELD OVERFLOW", false },
57  { "22012", "DIVISION BY ZERO", false },
58  { "22005", "ERROR IN ASSIGNMENT", false },
59  { "2200B", "ESCAPE CHARACTER CONFLICT", false },
60  { "22022", "INDICATOR OVERFLOW", false },
61  { "22015", "INTERVAL FIELD OVERFLOW", false },
62  { "2201E", "INVALID ARGUMENT FOR LOGARITHM", false },
63  { "2201F", "INVALID ARGUMENT FOR POWER FUNCTION", false },
64  { "2201G", "INVALID ARGUMENT FOR WIDTH BUCKET FUNCTION", false },
65  { "22018", "INVALID CHARACTER VALUE FOR CAST", false },
66  { "22007", "INVALID DATETIME FORMAT", false },
67  { "22019", "INVALID ESCAPE CHARACTER", false },
68  { "2200D", "INVALID ESCAPE OCTET", false },
69  { "22025", "INVALID ESCAPE SEQUENCE", false },
70  { "22P06", "NONSTANDARD USE OF ESCAPE CHARACTER", false },
71  { "22010", "INVALID INDICATOR PARAMETER VALUE", false },
72  { "22020", "INVALID LIMIT VALUE", false },
73  { "22023", "INVALID PARAMETER VALUE", false },
74  { "2201B", "INVALID REGULAR EXPRESSION", false },
75  { "22009", "INVALID TIME ZONE DISPLACEMENT VALUE", false },
76  { "2200C", "INVALID USE OF ESCAPE CHARACTER", false },
77  { "2200G", "MOST SPECIFIC TYPE MISMATCH", false },
78  { "22004", "NULL VALUE NOT ALLOWED", false },
79  { "22002", "NULL VALUE NO INDICATOR PARAMETER", false },
80  { "22003", "NUMERIC VALUE OUT OF RANGE", false },
81  { "22026", "STRING DATA LENGTH MISMATCH", false },
82  { "22001", "STRING DATA RIGHT TRUNCATION", false },
83  { "22011", "SUBSTRING ERROR", false },
84  { "22027", "TRIM ERROR", false },
85  { "22024", "UNTERMINATED C STRING", false },
86  { "2200F", "ZERO LENGTH CHARACTER STRING", false },
87  { "22P01", "FLOATING POINT EXCEPTION", false },
88  { "22P02", "INVALID TEXT REPRESENTATION", false },
89  { "22P03", "INVALID BINARY REPRESENTATION", false },
90  { "22P04", "BAD COPY FILE FORMAT", false },
91  { "22P05", "UNTRANSLATABLE CHARACTER", false },
92 
93  { "23000", "INTEGRITY CONSTRAINT VIOLATION", false },
94  { "23001", "RESTRICT VIOLATION", false },
95  { "23502", "NOT NULL VIOLATION", false },
96  { "23503", "FOREIGN KEY VIOLATION", false },
97  { "23514", "CHECK VIOLATION", false },
98 
99  { "24000", "INVALID CURSOR STATE", false },
100 
101  { "25000", "INVALID TRANSACTION STATE", false },
102  { "25001", "ACTIVE SQL TRANSACTION", false },
103  { "25002", "BRANCH TRANSACTION ALREADY ACTIVE", false },
104  { "25008", "HELD CURSOR REQUIRES SAME ISOLATION LEVEL", false },
105  { "25003", "INAPPROPRIATE ACCESS MODE FOR BRANCH TRANSACTION", false },
106  { "25004", "INAPPROPRIATE ISOLATION LEVEL FOR BRANCH TRANSACTION", false },
107  { "25005", "NO ACTIVE SQL TRANSACTION FOR BRANCH TRANSACTION", false },
108  { "25006", "READ ONLY SQL TRANSACTION", false },
109  { "25007", "SCHEMA AND DATA STATEMENT MIXING NOT SUPPORTED", false },
110  { "25P01", "NO ACTIVE SQL TRANSACTION", false },
111  { "25P02", "IN FAILED SQL TRANSACTION", false },
112 
113  { "26000", "INVALID SQL STATEMENT NAME", false },
114 
115  { "27000", "TRIGGERED DATA CHANGE VIOLATION", false },
116 
117  { "28000", "INVALID AUTHORIZATION SPECIFICATION", false },
118 
119  { "2B000", "DEPENDENT PRIVILEGE DESCRIPTORS STILL EXIST", false },
120  { "2BP01", "DEPENDENT OBJECTS STILL EXIST", false },
121 
122  { "2D000", "INVALID TRANSACTION TERMINATION", false },
123 
124  { "2F000", "SQL ROUTINE EXCEPTION", false },
125  { "2F005", "FUNCTION EXECUTED NO RETURN STATEMENT", false },
126  { "2F002", "MODIFYING SQL DATA NOT PERMITTED", false },
127  { "2F003", "PROHIBITED SQL STATEMENT ATTEMPTED", false },
128  { "2F004", "READING SQL DATA NOT PERMITTED", false },
129 
130  { "34000", "INVALID CURSOR NAME", false },
131 
132  { "38000", "EXTERNAL ROUTINE EXCEPTION", false },
133  { "38001", "CONTAINING SQL NOT PERMITTED", false },
134  { "38002", "MODIFYING SQL DATA NOT PERMITTED", false },
135  { "38003", "PROHIBITED SQL STATEMENT ATTEMPTED", false },
136  { "38004", "READING SQL DATA NOT PERMITTED", false },
137 
138  { "39000", "EXTERNAL ROUTINE INVOCATION EXCEPTION", false },
139  { "39001", "INVALID SQLSTATE RETURNED", false },
140  { "39004", "NULL VALUE NOT ALLOWED", false },
141  { "39P01", "TRIGGER PROTOCOL VIOLATED", false },
142  { "39P02", "SRF PROTOCOL VIOLATED", false },
143 
144  { "3B000", "SAVEPOINT EXCEPTION", false },
145  { "3B001", "INVALID SAVEPOINT SPECIFICATION", false },
146 
147  { "3D000", "INVALID CATALOG NAME", false },
148  { "3F000", "INVALID SCHEMA NAME", false },
149 
150  { "40000", "TRANSACTION ROLLBACK", false },
151  { "40002", "TRANSACTION INTEGRITY CONSTRAINT VIOLATION", false },
152  { "40001", "SERIALIZATION FAILURE", false },
153  { "40003", "STATEMENT COMPLETION UNKNOWN", false },
154  { "40P01", "DEADLOCK DETECTED", false },
155 
156  { "44000", "WITH CHECK OPTION VIOLATION", false },
157 
158  { "53000", "INSUFFICIENT RESOURCES", false },
159  { "53100", "DISK FULL", false },
160  { "53200", "OUT OF MEMORY", false },
161  { "53300", "TOO MANY CONNECTIONS", false },
162 
163  { "54000", "PROGRAM LIMIT EXCEEDED", false },
164  { "54001", "STATEMENT TOO COMPLEX", false },
165  { "54011", "TOO MANY COLUMNS", false },
166  { "54023", "TOO MANY ARGUMENTS", false },
167 
168  { "55000", "OBJECT NOT IN PREREQUISITE STATE", false },
169  { "55006", "OBJECT IN USE", false },
170  { "55P02", "CANT CHANGE RUNTIME PARAM", false },
171  { "55P03", "LOCK NOT AVAILABLE", false },
172 
173  { "57000", "OPERATOR INTERVENTION", true },
174 
175  /*
176  * This is really 'statement_timeout' or the error which is returned when
177  * 'statement_timeout' is hit.
178  *
179  * It's unlikely that this has been caused by a connection failure, and
180  * most likely to have been caused by a long running query.
181  *
182  * If the query is persistently long running then the database/query should
183  * be optimised, or 'statement_timeout' should be increased.
184  *
185  * Forcing a reconnect here only eats more resources on the DB so we will
186  * no longer do so as of 3.0.4.
187  */
188  { "57014", "QUERY CANCELED", false },
189  { "57P01", "ADMIN SHUTDOWN", true },
190  { "57P02", "CRASH SHUTDOWN", true },
191  { "57P03", "CANNOT CONNECT NOW", true },
192 
193  { "58030", "IO ERROR", true },
194  { "58P01", "UNDEFINED FILE", true },
195  { "58P02", "DUPLICATE FILE", true },
196 
197  { "F0000", "CONFIG FILE ERROR", true },
198  { "F0001", "LOCK FILE EXISTS", true },
199 
200  { "P0000", "PLPGSQL ERROR", false },
201  { "P0001", "RAISE EXCEPTION", false },
202 
203  { "42000", "SYNTAX ERROR OR ACCESS RULE VIOLATION", false },
204  { "42601", "SYNTAX ERROR", false },
205  { "42501", "INSUFFICIENT PRIVILEGE", false },
206  { "42846", "CANNOT COERCE", false },
207  { "42803", "GROUPING ERROR", false },
208  { "42830", "INVALID FOREIGN KEY", false },
209  { "42602", "INVALID NAME", false },
210  { "42622", "NAME TOO LONG", false },
211  { "42939", "RESERVED NAME", false },
212  { "42804", "DATATYPE MISMATCH", false },
213  { "42P18", "INDETERMINATE DATATYPE", false },
214  { "42809", "WRONG OBJECT TYPE", false },
215  { "42703", "UNDEFINED COLUMN", false },
216  { "42883", "UNDEFINED FUNCTION", false },
217  { "42P01", "UNDEFINED TABLE", false },
218  { "42P02", "UNDEFINED PARAMETER", false },
219  { "42704", "UNDEFINED OBJECT", false },
220  { "42701", "DUPLICATE COLUMN", false },
221  { "42P03", "DUPLICATE CURSOR", false },
222  { "42P04", "DUPLICATE DATABASE", false },
223  { "42723", "DUPLICATE FUNCTION", false },
224  { "42P05", "DUPLICATE PREPARED STATEMENT", false },
225  { "42P06", "DUPLICATE SCHEMA", false },
226  { "42P07", "DUPLICATE TABLE", false },
227  { "42712", "DUPLICATE ALIAS", false },
228  { "42710", "DUPLICATE OBJECT", false },
229  { "42702", "AMBIGUOUS COLUMN", false },
230  { "42725", "AMBIGUOUS FUNCTION", false },
231  { "42P08", "AMBIGUOUS PARAMETER", false },
232  { "42P09", "AMBIGUOUS ALIAS", false },
233  { "42P10", "INVALID COLUMN REFERENCE", false },
234  { "42611", "INVALID COLUMN DEFINITION", false },
235  { "42P11", "INVALID CURSOR DEFINITION", false },
236  { "42P12", "INVALID DATABASE DEFINITION", false },
237  { "42P13", "INVALID FUNCTION DEFINITION", false },
238  { "42P14", "INVALID PREPARED STATEMENT DEFINITION", false },
239  { "42P15", "INVALID SCHEMA DEFINITION", false },
240  { "42P16", "INVALID TABLE DEFINITION", false },
241  { "42P17", "INVALID OBJECT DEFINITION", false },
242 
243  { "XX000", "INTERNAL ERROR", false },
244  { "XX001", "DATA CORRUPTED", false },
245  { "XX002", "INDEX CORRUPTED", false },
246 
247  { NULL, NULL, 0 }
248 };
249 
250 #endif /*_SQL_POSTGRESQL_H_*/
#define RCSIDH(h, id)
Definition: build.h:136
Error Codes and required information.
bool reconnect
Should reconnect socket when receiving this error.
struct pgsql_error pgerror
Error Codes and required information.
static pgerror errorcodes[]
char const * meaning
Verbose description.
char const * errorcode
5 char error code from PG_DIAG_SQLSTATE.