pg 0.12.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data/BSDL +22 -0
- data/ChangeLog +1504 -11
- data/Contributors.rdoc +7 -0
- data/History.rdoc +181 -3
- data/LICENSE +12 -14
- data/Manifest.txt +29 -15
- data/{BSD → POSTGRES} +0 -0
- data/{README.OS_X.rdoc → README-OS_X.rdoc} +0 -0
- data/{README.windows.rdoc → README-Windows.rdoc} +0 -0
- data/README.ja.rdoc +10 -3
- data/README.rdoc +54 -28
- data/Rakefile +53 -26
- data/Rakefile.cross +235 -196
- data/ext/errorcodes.def +931 -0
- data/ext/errorcodes.rb +45 -0
- data/ext/errorcodes.txt +463 -0
- data/ext/extconf.rb +37 -7
- data/ext/gvl_wrappers.c +19 -0
- data/ext/gvl_wrappers.h +211 -0
- data/ext/pg.c +317 -4277
- data/ext/pg.h +124 -21
- data/ext/pg_connection.c +3642 -0
- data/ext/pg_errors.c +89 -0
- data/ext/pg_result.c +920 -0
- data/lib/pg/connection.rb +86 -0
- data/lib/pg/constants.rb +11 -0
- data/lib/pg/exceptions.rb +11 -0
- data/lib/pg/result.rb +16 -0
- data/lib/pg.rb +26 -43
- data/sample/array_insert.rb +20 -0
- data/sample/async_api.rb +21 -24
- data/sample/async_copyto.rb +2 -2
- data/sample/async_mixed.rb +56 -0
- data/sample/check_conn.rb +21 -0
- data/sample/copyfrom.rb +1 -1
- data/sample/copyto.rb +1 -1
- data/sample/cursor.rb +2 -2
- data/sample/disk_usage_report.rb +186 -0
- data/sample/issue-119.rb +94 -0
- data/sample/losample.rb +6 -6
- data/sample/minimal-testcase.rb +17 -0
- data/sample/notify_wait.rb +51 -22
- data/sample/pg_statistics.rb +294 -0
- data/sample/replication_monitor.rb +231 -0
- data/sample/test_binary_values.rb +4 -6
- data/sample/wal_shipper.rb +434 -0
- data/sample/warehouse_partitions.rb +320 -0
- data/spec/lib/helpers.rb +70 -23
- data/spec/pg/connection_spec.rb +1128 -0
- data/spec/{pgresult_spec.rb → pg/result_spec.rb} +142 -47
- data/spec/pg_spec.rb +44 -0
- data.tar.gz.sig +0 -0
- metadata +145 -100
- metadata.gz.sig +0 -0
- data/GPL +0 -340
- data/ext/compat.c +0 -541
- data/ext/compat.h +0 -184
- data/misc/openssl-pg-segfault.rb +0 -31
- data/sample/psql.rb +0 -1181
- data/sample/psqlHelp.rb +0 -158
- data/sample/test1.rb +0 -60
- data/sample/test2.rb +0 -44
- data/sample/test4.rb +0 -71
- data/spec/m17n_spec.rb +0 -151
- data/spec/pgconn_spec.rb +0 -643
data/ext/errorcodes.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
def camelize(lower_case_and_underscored_word)
|
4
|
+
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
|
5
|
+
end
|
6
|
+
|
7
|
+
ec_txt, ec_def = *ARGV
|
8
|
+
|
9
|
+
File.open(ec_def, 'w') do |fd_def|
|
10
|
+
fd_def.puts <<EOCODE
|
11
|
+
/*
|
12
|
+
* #{ec_def} - Definition of error classes.
|
13
|
+
*
|
14
|
+
* WARNING: This file is autogenerated. Please edit #{__FILE__} !
|
15
|
+
*
|
16
|
+
*/
|
17
|
+
|
18
|
+
|
19
|
+
EOCODE
|
20
|
+
|
21
|
+
File.read(ec_txt).lines.each do |line|
|
22
|
+
# The format of this file is one error code per line, with the following
|
23
|
+
# whitespace-separated fields:
|
24
|
+
#
|
25
|
+
# sqlstate E/W/S errcode_macro_name spec_name
|
26
|
+
|
27
|
+
if line =~ /^(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+/i
|
28
|
+
sqlstate, ews, errcode_macro_name = $1, $2, $3
|
29
|
+
next unless ews=='E'
|
30
|
+
|
31
|
+
is_sqlclass = sqlstate[2..-1] == '000'
|
32
|
+
class_code = sqlstate[0,2]
|
33
|
+
baseclass_code = is_sqlclass ? 'NULL' : class_code.inspect
|
34
|
+
class_name = camelize(errcode_macro_name.sub('ERRCODE_', '').downcase)
|
35
|
+
|
36
|
+
fd_def.puts "{"
|
37
|
+
fd_def.puts " VALUE klass = define_error_class( #{class_name.inspect}, #{baseclass_code} );"
|
38
|
+
fd_def.puts " register_error_class( #{sqlstate.inspect}, klass );"
|
39
|
+
if is_sqlclass
|
40
|
+
fd_def.puts " register_error_class( #{class_code.inspect}, klass );"
|
41
|
+
end
|
42
|
+
fd_def.puts "}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/ext/errorcodes.txt
ADDED
@@ -0,0 +1,463 @@
|
|
1
|
+
#
|
2
|
+
# errcodes.txt
|
3
|
+
# PostgreSQL error codes
|
4
|
+
#
|
5
|
+
# Copyright (c) 2003-2013, PostgreSQL Global Development Group
|
6
|
+
#
|
7
|
+
# This list serves as the basis for generating source files containing error
|
8
|
+
# codes. It is kept in a common format to make sure all these source files have
|
9
|
+
# the same contents.
|
10
|
+
# The files generated from this one are:
|
11
|
+
#
|
12
|
+
# src/include/utils/errcodes.h
|
13
|
+
# macros defining errcode constants to be used in the rest of the source
|
14
|
+
#
|
15
|
+
# src/pl/plpgsql/src/plerrcodes.h
|
16
|
+
# a list of PL/pgSQL condition names and their SQLSTATE codes
|
17
|
+
#
|
18
|
+
# doc/src/sgml/errcodes-list.sgml
|
19
|
+
# a SGML table of error codes for inclusion in the documentation
|
20
|
+
#
|
21
|
+
# The format of this file is one error code per line, with the following
|
22
|
+
# whitespace-separated fields:
|
23
|
+
#
|
24
|
+
# sqlstate E/W/S errcode_macro_name spec_name
|
25
|
+
#
|
26
|
+
# where sqlstate is a five-character string following the SQLSTATE conventions,
|
27
|
+
# the second field indicates if the code means an error, a warning or success,
|
28
|
+
# errcode_macro_name is the C macro name starting with ERRCODE that will be put
|
29
|
+
# in errcodes.h, and spec_name is a lowercase, underscore-separated name that
|
30
|
+
# will be used as the PL/pgSQL condition name and will also be included in the
|
31
|
+
# SGML list. The last field is optional, if not present the PL/pgSQL condition
|
32
|
+
# and the SGML entry will not be generated.
|
33
|
+
#
|
34
|
+
# Empty lines and lines starting with a hash are comments.
|
35
|
+
#
|
36
|
+
# There are also special lines in the format of:
|
37
|
+
#
|
38
|
+
# Section: section description
|
39
|
+
#
|
40
|
+
# that is, lines starting with the string "Section:". They are used to delimit
|
41
|
+
# error classes as defined in the SQL spec, and are necessary for SGML output.
|
42
|
+
#
|
43
|
+
#
|
44
|
+
# SQLSTATE codes for errors.
|
45
|
+
#
|
46
|
+
# The SQL99 code set is rather impoverished, especially in the area of
|
47
|
+
# syntactical and semantic errors. We have borrowed codes from IBM's DB2
|
48
|
+
# and invented our own codes to develop a useful code set.
|
49
|
+
#
|
50
|
+
# When adding a new code, make sure it is placed in the most appropriate
|
51
|
+
# class (the first two characters of the code value identify the class).
|
52
|
+
# The listing is organized by class to make this prominent.
|
53
|
+
#
|
54
|
+
# Each class should have a generic '000' subclass. However,
|
55
|
+
# the generic '000' subclass code should be used for an error only
|
56
|
+
# when there is not a more-specific subclass code defined.
|
57
|
+
#
|
58
|
+
# The SQL spec requires that all the elements of a SQLSTATE code be
|
59
|
+
# either digits or upper-case ASCII characters.
|
60
|
+
#
|
61
|
+
# Classes that begin with 0-4 or A-H are defined by the
|
62
|
+
# standard. Within such a class, subclass values defined by the
|
63
|
+
# standard must begin with 0-4 or A-H. To define a new error code,
|
64
|
+
# ensure that it is either in an "implementation-defined class" (it
|
65
|
+
# begins with 5-9 or I-Z), or its subclass falls outside the range of
|
66
|
+
# error codes that could be present in future versions of the
|
67
|
+
# standard (i.e. the subclass value begins with 5-9 or I-Z).
|
68
|
+
#
|
69
|
+
# The convention is that new error codes defined by PostgreSQL in a
|
70
|
+
# class defined by the standard have a subclass value that begins
|
71
|
+
# with 'P'. In addition, error codes defined by PostgreSQL clients
|
72
|
+
# (such as ecpg) have a class value that begins with 'Y'.
|
73
|
+
|
74
|
+
Section: Class 00 - Successful Completion
|
75
|
+
|
76
|
+
00000 S ERRCODE_SUCCESSFUL_COMPLETION successful_completion
|
77
|
+
|
78
|
+
Section: Class 01 - Warning
|
79
|
+
|
80
|
+
# do not use this class for failure conditions
|
81
|
+
01000 W ERRCODE_WARNING warning
|
82
|
+
0100C W ERRCODE_WARNING_DYNAMIC_RESULT_SETS_RETURNED dynamic_result_sets_returned
|
83
|
+
01008 W ERRCODE_WARNING_IMPLICIT_ZERO_BIT_PADDING implicit_zero_bit_padding
|
84
|
+
01003 W ERRCODE_WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION null_value_eliminated_in_set_function
|
85
|
+
01007 W ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED privilege_not_granted
|
86
|
+
01006 W ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED privilege_not_revoked
|
87
|
+
01004 W ERRCODE_WARNING_STRING_DATA_RIGHT_TRUNCATION string_data_right_truncation
|
88
|
+
01P01 W ERRCODE_WARNING_DEPRECATED_FEATURE deprecated_feature
|
89
|
+
|
90
|
+
Section: Class 02 - No Data (this is also a warning class per the SQL standard)
|
91
|
+
|
92
|
+
# do not use this class for failure conditions
|
93
|
+
02000 W ERRCODE_NO_DATA no_data
|
94
|
+
02001 W ERRCODE_NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED no_additional_dynamic_result_sets_returned
|
95
|
+
|
96
|
+
Section: Class 03 - SQL Statement Not Yet Complete
|
97
|
+
|
98
|
+
03000 E ERRCODE_SQL_STATEMENT_NOT_YET_COMPLETE sql_statement_not_yet_complete
|
99
|
+
|
100
|
+
Section: Class 08 - Connection Exception
|
101
|
+
|
102
|
+
08000 E ERRCODE_CONNECTION_EXCEPTION connection_exception
|
103
|
+
08003 E ERRCODE_CONNECTION_DOES_NOT_EXIST connection_does_not_exist
|
104
|
+
08006 E ERRCODE_CONNECTION_FAILURE connection_failure
|
105
|
+
08001 E ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION sqlclient_unable_to_establish_sqlconnection
|
106
|
+
08004 E ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION sqlserver_rejected_establishment_of_sqlconnection
|
107
|
+
08007 E ERRCODE_TRANSACTION_RESOLUTION_UNKNOWN transaction_resolution_unknown
|
108
|
+
08P01 E ERRCODE_PROTOCOL_VIOLATION protocol_violation
|
109
|
+
|
110
|
+
Section: Class 09 - Triggered Action Exception
|
111
|
+
|
112
|
+
09000 E ERRCODE_TRIGGERED_ACTION_EXCEPTION triggered_action_exception
|
113
|
+
|
114
|
+
Section: Class 0A - Feature Not Supported
|
115
|
+
|
116
|
+
0A000 E ERRCODE_FEATURE_NOT_SUPPORTED feature_not_supported
|
117
|
+
|
118
|
+
Section: Class 0B - Invalid Transaction Initiation
|
119
|
+
|
120
|
+
0B000 E ERRCODE_INVALID_TRANSACTION_INITIATION invalid_transaction_initiation
|
121
|
+
|
122
|
+
Section: Class 0F - Locator Exception
|
123
|
+
|
124
|
+
0F000 E ERRCODE_LOCATOR_EXCEPTION locator_exception
|
125
|
+
0F001 E ERRCODE_L_E_INVALID_SPECIFICATION invalid_locator_specification
|
126
|
+
|
127
|
+
Section: Class 0L - Invalid Grantor
|
128
|
+
|
129
|
+
0L000 E ERRCODE_INVALID_GRANTOR invalid_grantor
|
130
|
+
0LP01 E ERRCODE_INVALID_GRANT_OPERATION invalid_grant_operation
|
131
|
+
|
132
|
+
Section: Class 0P - Invalid Role Specification
|
133
|
+
|
134
|
+
0P000 E ERRCODE_INVALID_ROLE_SPECIFICATION invalid_role_specification
|
135
|
+
|
136
|
+
Section: Class 0Z - Diagnostics Exception
|
137
|
+
|
138
|
+
0Z000 E ERRCODE_DIAGNOSTICS_EXCEPTION diagnostics_exception
|
139
|
+
0Z002 E ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER stacked_diagnostics_accessed_without_active_handler
|
140
|
+
|
141
|
+
Section: Class 20 - Case Not Found
|
142
|
+
|
143
|
+
20000 E ERRCODE_CASE_NOT_FOUND case_not_found
|
144
|
+
|
145
|
+
Section: Class 21 - Cardinality Violation
|
146
|
+
|
147
|
+
# this means something returned the wrong number of rows
|
148
|
+
21000 E ERRCODE_CARDINALITY_VIOLATION cardinality_violation
|
149
|
+
|
150
|
+
Section: Class 22 - Data Exception
|
151
|
+
|
152
|
+
22000 E ERRCODE_DATA_EXCEPTION data_exception
|
153
|
+
2202E E ERRCODE_ARRAY_ELEMENT_ERROR
|
154
|
+
# SQL99's actual definition of "array element error" is subscript error
|
155
|
+
2202E E ERRCODE_ARRAY_SUBSCRIPT_ERROR array_subscript_error
|
156
|
+
22021 E ERRCODE_CHARACTER_NOT_IN_REPERTOIRE character_not_in_repertoire
|
157
|
+
22008 E ERRCODE_DATETIME_FIELD_OVERFLOW datetime_field_overflow
|
158
|
+
22008 E ERRCODE_DATETIME_VALUE_OUT_OF_RANGE
|
159
|
+
22012 E ERRCODE_DIVISION_BY_ZERO division_by_zero
|
160
|
+
22005 E ERRCODE_ERROR_IN_ASSIGNMENT error_in_assignment
|
161
|
+
2200B E ERRCODE_ESCAPE_CHARACTER_CONFLICT escape_character_conflict
|
162
|
+
22022 E ERRCODE_INDICATOR_OVERFLOW indicator_overflow
|
163
|
+
22015 E ERRCODE_INTERVAL_FIELD_OVERFLOW interval_field_overflow
|
164
|
+
2201E E ERRCODE_INVALID_ARGUMENT_FOR_LOG invalid_argument_for_logarithm
|
165
|
+
22014 E ERRCODE_INVALID_ARGUMENT_FOR_NTILE invalid_argument_for_ntile_function
|
166
|
+
22016 E ERRCODE_INVALID_ARGUMENT_FOR_NTH_VALUE invalid_argument_for_nth_value_function
|
167
|
+
2201F E ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION invalid_argument_for_power_function
|
168
|
+
2201G E ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION invalid_argument_for_width_bucket_function
|
169
|
+
22018 E ERRCODE_INVALID_CHARACTER_VALUE_FOR_CAST invalid_character_value_for_cast
|
170
|
+
22007 E ERRCODE_INVALID_DATETIME_FORMAT invalid_datetime_format
|
171
|
+
22019 E ERRCODE_INVALID_ESCAPE_CHARACTER invalid_escape_character
|
172
|
+
2200D E ERRCODE_INVALID_ESCAPE_OCTET invalid_escape_octet
|
173
|
+
22025 E ERRCODE_INVALID_ESCAPE_SEQUENCE invalid_escape_sequence
|
174
|
+
22P06 E ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER nonstandard_use_of_escape_character
|
175
|
+
22010 E ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE invalid_indicator_parameter_value
|
176
|
+
22023 E ERRCODE_INVALID_PARAMETER_VALUE invalid_parameter_value
|
177
|
+
2201B E ERRCODE_INVALID_REGULAR_EXPRESSION invalid_regular_expression
|
178
|
+
2201W E ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE invalid_row_count_in_limit_clause
|
179
|
+
2201X E ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE invalid_row_count_in_result_offset_clause
|
180
|
+
22009 E ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE invalid_time_zone_displacement_value
|
181
|
+
2200C E ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER invalid_use_of_escape_character
|
182
|
+
2200G E ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH most_specific_type_mismatch
|
183
|
+
22004 E ERRCODE_NULL_VALUE_NOT_ALLOWED null_value_not_allowed
|
184
|
+
22002 E ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER null_value_no_indicator_parameter
|
185
|
+
22003 E ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE numeric_value_out_of_range
|
186
|
+
22026 E ERRCODE_STRING_DATA_LENGTH_MISMATCH string_data_length_mismatch
|
187
|
+
22001 E ERRCODE_STRING_DATA_RIGHT_TRUNCATION string_data_right_truncation
|
188
|
+
22011 E ERRCODE_SUBSTRING_ERROR substring_error
|
189
|
+
22027 E ERRCODE_TRIM_ERROR trim_error
|
190
|
+
22024 E ERRCODE_UNTERMINATED_C_STRING unterminated_c_string
|
191
|
+
2200F E ERRCODE_ZERO_LENGTH_CHARACTER_STRING zero_length_character_string
|
192
|
+
22P01 E ERRCODE_FLOATING_POINT_EXCEPTION floating_point_exception
|
193
|
+
22P02 E ERRCODE_INVALID_TEXT_REPRESENTATION invalid_text_representation
|
194
|
+
22P03 E ERRCODE_INVALID_BINARY_REPRESENTATION invalid_binary_representation
|
195
|
+
22P04 E ERRCODE_BAD_COPY_FILE_FORMAT bad_copy_file_format
|
196
|
+
22P05 E ERRCODE_UNTRANSLATABLE_CHARACTER untranslatable_character
|
197
|
+
2200L E ERRCODE_NOT_AN_XML_DOCUMENT not_an_xml_document
|
198
|
+
2200M E ERRCODE_INVALID_XML_DOCUMENT invalid_xml_document
|
199
|
+
2200N E ERRCODE_INVALID_XML_CONTENT invalid_xml_content
|
200
|
+
2200S E ERRCODE_INVALID_XML_COMMENT invalid_xml_comment
|
201
|
+
2200T E ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION invalid_xml_processing_instruction
|
202
|
+
|
203
|
+
Section: Class 23 - Integrity Constraint Violation
|
204
|
+
|
205
|
+
23000 E ERRCODE_INTEGRITY_CONSTRAINT_VIOLATION integrity_constraint_violation
|
206
|
+
23001 E ERRCODE_RESTRICT_VIOLATION restrict_violation
|
207
|
+
23502 E ERRCODE_NOT_NULL_VIOLATION not_null_violation
|
208
|
+
23503 E ERRCODE_FOREIGN_KEY_VIOLATION foreign_key_violation
|
209
|
+
23505 E ERRCODE_UNIQUE_VIOLATION unique_violation
|
210
|
+
23514 E ERRCODE_CHECK_VIOLATION check_violation
|
211
|
+
23P01 E ERRCODE_EXCLUSION_VIOLATION exclusion_violation
|
212
|
+
|
213
|
+
Section: Class 24 - Invalid Cursor State
|
214
|
+
|
215
|
+
24000 E ERRCODE_INVALID_CURSOR_STATE invalid_cursor_state
|
216
|
+
|
217
|
+
Section: Class 25 - Invalid Transaction State
|
218
|
+
|
219
|
+
25000 E ERRCODE_INVALID_TRANSACTION_STATE invalid_transaction_state
|
220
|
+
25001 E ERRCODE_ACTIVE_SQL_TRANSACTION active_sql_transaction
|
221
|
+
25002 E ERRCODE_BRANCH_TRANSACTION_ALREADY_ACTIVE branch_transaction_already_active
|
222
|
+
25008 E ERRCODE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL held_cursor_requires_same_isolation_level
|
223
|
+
25003 E ERRCODE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION inappropriate_access_mode_for_branch_transaction
|
224
|
+
25004 E ERRCODE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION inappropriate_isolation_level_for_branch_transaction
|
225
|
+
25005 E ERRCODE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION no_active_sql_transaction_for_branch_transaction
|
226
|
+
25006 E ERRCODE_READ_ONLY_SQL_TRANSACTION read_only_sql_transaction
|
227
|
+
25007 E ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED schema_and_data_statement_mixing_not_supported
|
228
|
+
25P01 E ERRCODE_NO_ACTIVE_SQL_TRANSACTION no_active_sql_transaction
|
229
|
+
25P02 E ERRCODE_IN_FAILED_SQL_TRANSACTION in_failed_sql_transaction
|
230
|
+
|
231
|
+
Section: Class 26 - Invalid SQL Statement Name
|
232
|
+
|
233
|
+
# (we take this to mean prepared statements
|
234
|
+
26000 E ERRCODE_INVALID_SQL_STATEMENT_NAME invalid_sql_statement_name
|
235
|
+
|
236
|
+
Section: Class 27 - Triggered Data Change Violation
|
237
|
+
|
238
|
+
27000 E ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION triggered_data_change_violation
|
239
|
+
|
240
|
+
Section: Class 28 - Invalid Authorization Specification
|
241
|
+
|
242
|
+
28000 E ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION invalid_authorization_specification
|
243
|
+
28P01 E ERRCODE_INVALID_PASSWORD invalid_password
|
244
|
+
|
245
|
+
Section: Class 2B - Dependent Privilege Descriptors Still Exist
|
246
|
+
|
247
|
+
2B000 E ERRCODE_DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST dependent_privilege_descriptors_still_exist
|
248
|
+
2BP01 E ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST dependent_objects_still_exist
|
249
|
+
|
250
|
+
Section: Class 2D - Invalid Transaction Termination
|
251
|
+
|
252
|
+
2D000 E ERRCODE_INVALID_TRANSACTION_TERMINATION invalid_transaction_termination
|
253
|
+
|
254
|
+
Section: Class 2F - SQL Routine Exception
|
255
|
+
|
256
|
+
2F000 E ERRCODE_SQL_ROUTINE_EXCEPTION sql_routine_exception
|
257
|
+
2F005 E ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT function_executed_no_return_statement
|
258
|
+
2F002 E ERRCODE_S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED modifying_sql_data_not_permitted
|
259
|
+
2F003 E ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED prohibited_sql_statement_attempted
|
260
|
+
2F004 E ERRCODE_S_R_E_READING_SQL_DATA_NOT_PERMITTED reading_sql_data_not_permitted
|
261
|
+
|
262
|
+
Section: Class 34 - Invalid Cursor Name
|
263
|
+
|
264
|
+
34000 E ERRCODE_INVALID_CURSOR_NAME invalid_cursor_name
|
265
|
+
|
266
|
+
Section: Class 38 - External Routine Exception
|
267
|
+
|
268
|
+
38000 E ERRCODE_EXTERNAL_ROUTINE_EXCEPTION external_routine_exception
|
269
|
+
38001 E ERRCODE_E_R_E_CONTAINING_SQL_NOT_PERMITTED containing_sql_not_permitted
|
270
|
+
38002 E ERRCODE_E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED modifying_sql_data_not_permitted
|
271
|
+
38003 E ERRCODE_E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED prohibited_sql_statement_attempted
|
272
|
+
38004 E ERRCODE_E_R_E_READING_SQL_DATA_NOT_PERMITTED reading_sql_data_not_permitted
|
273
|
+
|
274
|
+
Section: Class 39 - External Routine Invocation Exception
|
275
|
+
|
276
|
+
39000 E ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION external_routine_invocation_exception
|
277
|
+
39001 E ERRCODE_E_R_I_E_INVALID_SQLSTATE_RETURNED invalid_sqlstate_returned
|
278
|
+
39004 E ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED null_value_not_allowed
|
279
|
+
39P01 E ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED trigger_protocol_violated
|
280
|
+
39P02 E ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED srf_protocol_violated
|
281
|
+
|
282
|
+
Section: Class 3B - Savepoint Exception
|
283
|
+
|
284
|
+
3B000 E ERRCODE_SAVEPOINT_EXCEPTION savepoint_exception
|
285
|
+
3B001 E ERRCODE_S_E_INVALID_SPECIFICATION invalid_savepoint_specification
|
286
|
+
|
287
|
+
Section: Class 3D - Invalid Catalog Name
|
288
|
+
|
289
|
+
3D000 E ERRCODE_INVALID_CATALOG_NAME invalid_catalog_name
|
290
|
+
|
291
|
+
Section: Class 3F - Invalid Schema Name
|
292
|
+
|
293
|
+
3F000 E ERRCODE_INVALID_SCHEMA_NAME invalid_schema_name
|
294
|
+
|
295
|
+
Section: Class 40 - Transaction Rollback
|
296
|
+
|
297
|
+
40000 E ERRCODE_TRANSACTION_ROLLBACK transaction_rollback
|
298
|
+
40002 E ERRCODE_T_R_INTEGRITY_CONSTRAINT_VIOLATION transaction_integrity_constraint_violation
|
299
|
+
40001 E ERRCODE_T_R_SERIALIZATION_FAILURE serialization_failure
|
300
|
+
40003 E ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN statement_completion_unknown
|
301
|
+
40P01 E ERRCODE_T_R_DEADLOCK_DETECTED deadlock_detected
|
302
|
+
|
303
|
+
Section: Class 42 - Syntax Error or Access Rule Violation
|
304
|
+
|
305
|
+
42000 E ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION syntax_error_or_access_rule_violation
|
306
|
+
# never use the above; use one of these two if no specific code exists:
|
307
|
+
42601 E ERRCODE_SYNTAX_ERROR syntax_error
|
308
|
+
42501 E ERRCODE_INSUFFICIENT_PRIVILEGE insufficient_privilege
|
309
|
+
42846 E ERRCODE_CANNOT_COERCE cannot_coerce
|
310
|
+
42803 E ERRCODE_GROUPING_ERROR grouping_error
|
311
|
+
42P20 E ERRCODE_WINDOWING_ERROR windowing_error
|
312
|
+
42P19 E ERRCODE_INVALID_RECURSION invalid_recursion
|
313
|
+
42830 E ERRCODE_INVALID_FOREIGN_KEY invalid_foreign_key
|
314
|
+
42602 E ERRCODE_INVALID_NAME invalid_name
|
315
|
+
42622 E ERRCODE_NAME_TOO_LONG name_too_long
|
316
|
+
42939 E ERRCODE_RESERVED_NAME reserved_name
|
317
|
+
42804 E ERRCODE_DATATYPE_MISMATCH datatype_mismatch
|
318
|
+
42P18 E ERRCODE_INDETERMINATE_DATATYPE indeterminate_datatype
|
319
|
+
42P21 E ERRCODE_COLLATION_MISMATCH collation_mismatch
|
320
|
+
42P22 E ERRCODE_INDETERMINATE_COLLATION indeterminate_collation
|
321
|
+
42809 E ERRCODE_WRONG_OBJECT_TYPE wrong_object_type
|
322
|
+
|
323
|
+
# Note: for ERRCODE purposes, we divide namable objects into these categories:
|
324
|
+
# databases, schemas, prepared statements, cursors, tables, columns,
|
325
|
+
# functions (including operators), and all else (lumped as "objects").
|
326
|
+
# (The first four categories are mandated by the existence of separate
|
327
|
+
# SQLSTATE classes for them in the spec; in this file, however, we group
|
328
|
+
# the ERRCODE names with all the rest under class 42.) Parameters are
|
329
|
+
# sort-of-named objects and get their own ERRCODE.
|
330
|
+
#
|
331
|
+
# The same breakdown is used for "duplicate" and "ambiguous" complaints,
|
332
|
+
# as well as complaints associated with incorrect declarations.
|
333
|
+
|
334
|
+
42703 E ERRCODE_UNDEFINED_COLUMN undefined_column
|
335
|
+
34000 E ERRCODE_UNDEFINED_CURSOR
|
336
|
+
3D000 E ERRCODE_UNDEFINED_DATABASE
|
337
|
+
42883 E ERRCODE_UNDEFINED_FUNCTION undefined_function
|
338
|
+
26000 E ERRCODE_UNDEFINED_PSTATEMENT
|
339
|
+
3F000 E ERRCODE_UNDEFINED_SCHEMA
|
340
|
+
42P01 E ERRCODE_UNDEFINED_TABLE undefined_table
|
341
|
+
42P02 E ERRCODE_UNDEFINED_PARAMETER undefined_parameter
|
342
|
+
42704 E ERRCODE_UNDEFINED_OBJECT undefined_object
|
343
|
+
42701 E ERRCODE_DUPLICATE_COLUMN duplicate_column
|
344
|
+
42P03 E ERRCODE_DUPLICATE_CURSOR duplicate_cursor
|
345
|
+
42P04 E ERRCODE_DUPLICATE_DATABASE duplicate_database
|
346
|
+
42723 E ERRCODE_DUPLICATE_FUNCTION duplicate_function
|
347
|
+
42P05 E ERRCODE_DUPLICATE_PSTATEMENT duplicate_prepared_statement
|
348
|
+
42P06 E ERRCODE_DUPLICATE_SCHEMA duplicate_schema
|
349
|
+
42P07 E ERRCODE_DUPLICATE_TABLE duplicate_table
|
350
|
+
42712 E ERRCODE_DUPLICATE_ALIAS duplicate_alias
|
351
|
+
42710 E ERRCODE_DUPLICATE_OBJECT duplicate_object
|
352
|
+
42702 E ERRCODE_AMBIGUOUS_COLUMN ambiguous_column
|
353
|
+
42725 E ERRCODE_AMBIGUOUS_FUNCTION ambiguous_function
|
354
|
+
42P08 E ERRCODE_AMBIGUOUS_PARAMETER ambiguous_parameter
|
355
|
+
42P09 E ERRCODE_AMBIGUOUS_ALIAS ambiguous_alias
|
356
|
+
42P10 E ERRCODE_INVALID_COLUMN_REFERENCE invalid_column_reference
|
357
|
+
42611 E ERRCODE_INVALID_COLUMN_DEFINITION invalid_column_definition
|
358
|
+
42P11 E ERRCODE_INVALID_CURSOR_DEFINITION invalid_cursor_definition
|
359
|
+
42P12 E ERRCODE_INVALID_DATABASE_DEFINITION invalid_database_definition
|
360
|
+
42P13 E ERRCODE_INVALID_FUNCTION_DEFINITION invalid_function_definition
|
361
|
+
42P14 E ERRCODE_INVALID_PSTATEMENT_DEFINITION invalid_prepared_statement_definition
|
362
|
+
42P15 E ERRCODE_INVALID_SCHEMA_DEFINITION invalid_schema_definition
|
363
|
+
42P16 E ERRCODE_INVALID_TABLE_DEFINITION invalid_table_definition
|
364
|
+
42P17 E ERRCODE_INVALID_OBJECT_DEFINITION invalid_object_definition
|
365
|
+
|
366
|
+
Section: Class 44 - WITH CHECK OPTION Violation
|
367
|
+
|
368
|
+
44000 E ERRCODE_WITH_CHECK_OPTION_VIOLATION with_check_option_violation
|
369
|
+
|
370
|
+
Section: Class 53 - Insufficient Resources
|
371
|
+
|
372
|
+
# (PostgreSQL-specific error class)
|
373
|
+
53000 E ERRCODE_INSUFFICIENT_RESOURCES insufficient_resources
|
374
|
+
53100 E ERRCODE_DISK_FULL disk_full
|
375
|
+
53200 E ERRCODE_OUT_OF_MEMORY out_of_memory
|
376
|
+
53300 E ERRCODE_TOO_MANY_CONNECTIONS too_many_connections
|
377
|
+
53400 E ERRCODE_CONFIGURATION_LIMIT_EXCEEDED configuration_limit_exceeded
|
378
|
+
|
379
|
+
Section: Class 54 - Program Limit Exceeded
|
380
|
+
|
381
|
+
# this is for wired-in limits, not resource exhaustion problems (class borrowed from DB2)
|
382
|
+
54000 E ERRCODE_PROGRAM_LIMIT_EXCEEDED program_limit_exceeded
|
383
|
+
54001 E ERRCODE_STATEMENT_TOO_COMPLEX statement_too_complex
|
384
|
+
54011 E ERRCODE_TOO_MANY_COLUMNS too_many_columns
|
385
|
+
54023 E ERRCODE_TOO_MANY_ARGUMENTS too_many_arguments
|
386
|
+
|
387
|
+
Section: Class 55 - Object Not In Prerequisite State
|
388
|
+
|
389
|
+
# (class borrowed from DB2)
|
390
|
+
55000 E ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE object_not_in_prerequisite_state
|
391
|
+
55006 E ERRCODE_OBJECT_IN_USE object_in_use
|
392
|
+
55P02 E ERRCODE_CANT_CHANGE_RUNTIME_PARAM cant_change_runtime_param
|
393
|
+
55P03 E ERRCODE_LOCK_NOT_AVAILABLE lock_not_available
|
394
|
+
|
395
|
+
Section: Class 57 - Operator Intervention
|
396
|
+
|
397
|
+
# (class borrowed from DB2)
|
398
|
+
57000 E ERRCODE_OPERATOR_INTERVENTION operator_intervention
|
399
|
+
57014 E ERRCODE_QUERY_CANCELED query_canceled
|
400
|
+
57P01 E ERRCODE_ADMIN_SHUTDOWN admin_shutdown
|
401
|
+
57P02 E ERRCODE_CRASH_SHUTDOWN crash_shutdown
|
402
|
+
57P03 E ERRCODE_CANNOT_CONNECT_NOW cannot_connect_now
|
403
|
+
57P04 E ERRCODE_DATABASE_DROPPED database_dropped
|
404
|
+
|
405
|
+
Section: Class 58 - System Error (errors external to PostgreSQL itself)
|
406
|
+
|
407
|
+
# (class borrowed from DB2)
|
408
|
+
58000 E ERRCODE_SYSTEM_ERROR system_error
|
409
|
+
58030 E ERRCODE_IO_ERROR io_error
|
410
|
+
58P01 E ERRCODE_UNDEFINED_FILE undefined_file
|
411
|
+
58P02 E ERRCODE_DUPLICATE_FILE duplicate_file
|
412
|
+
|
413
|
+
Section: Class F0 - Configuration File Error
|
414
|
+
|
415
|
+
# (PostgreSQL-specific error class)
|
416
|
+
F0000 E ERRCODE_CONFIG_FILE_ERROR config_file_error
|
417
|
+
F0001 E ERRCODE_LOCK_FILE_EXISTS lock_file_exists
|
418
|
+
|
419
|
+
Section: Class HV - Foreign Data Wrapper Error (SQL/MED)
|
420
|
+
|
421
|
+
# (SQL/MED-specific error class)
|
422
|
+
HV000 E ERRCODE_FDW_ERROR fdw_error
|
423
|
+
HV005 E ERRCODE_FDW_COLUMN_NAME_NOT_FOUND fdw_column_name_not_found
|
424
|
+
HV002 E ERRCODE_FDW_DYNAMIC_PARAMETER_VALUE_NEEDED fdw_dynamic_parameter_value_needed
|
425
|
+
HV010 E ERRCODE_FDW_FUNCTION_SEQUENCE_ERROR fdw_function_sequence_error
|
426
|
+
HV021 E ERRCODE_FDW_INCONSISTENT_DESCRIPTOR_INFORMATION fdw_inconsistent_descriptor_information
|
427
|
+
HV024 E ERRCODE_FDW_INVALID_ATTRIBUTE_VALUE fdw_invalid_attribute_value
|
428
|
+
HV007 E ERRCODE_FDW_INVALID_COLUMN_NAME fdw_invalid_column_name
|
429
|
+
HV008 E ERRCODE_FDW_INVALID_COLUMN_NUMBER fdw_invalid_column_number
|
430
|
+
HV004 E ERRCODE_FDW_INVALID_DATA_TYPE fdw_invalid_data_type
|
431
|
+
HV006 E ERRCODE_FDW_INVALID_DATA_TYPE_DESCRIPTORS fdw_invalid_data_type_descriptors
|
432
|
+
HV091 E ERRCODE_FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER fdw_invalid_descriptor_field_identifier
|
433
|
+
HV00B E ERRCODE_FDW_INVALID_HANDLE fdw_invalid_handle
|
434
|
+
HV00C E ERRCODE_FDW_INVALID_OPTION_INDEX fdw_invalid_option_index
|
435
|
+
HV00D E ERRCODE_FDW_INVALID_OPTION_NAME fdw_invalid_option_name
|
436
|
+
HV090 E ERRCODE_FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH fdw_invalid_string_length_or_buffer_length
|
437
|
+
HV00A E ERRCODE_FDW_INVALID_STRING_FORMAT fdw_invalid_string_format
|
438
|
+
HV009 E ERRCODE_FDW_INVALID_USE_OF_NULL_POINTER fdw_invalid_use_of_null_pointer
|
439
|
+
HV014 E ERRCODE_FDW_TOO_MANY_HANDLES fdw_too_many_handles
|
440
|
+
HV001 E ERRCODE_FDW_OUT_OF_MEMORY fdw_out_of_memory
|
441
|
+
HV00P E ERRCODE_FDW_NO_SCHEMAS fdw_no_schemas
|
442
|
+
HV00J E ERRCODE_FDW_OPTION_NAME_NOT_FOUND fdw_option_name_not_found
|
443
|
+
HV00K E ERRCODE_FDW_REPLY_HANDLE fdw_reply_handle
|
444
|
+
HV00Q E ERRCODE_FDW_SCHEMA_NOT_FOUND fdw_schema_not_found
|
445
|
+
HV00R E ERRCODE_FDW_TABLE_NOT_FOUND fdw_table_not_found
|
446
|
+
HV00L E ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION fdw_unable_to_create_execution
|
447
|
+
HV00M E ERRCODE_FDW_UNABLE_TO_CREATE_REPLY fdw_unable_to_create_reply
|
448
|
+
HV00N E ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION fdw_unable_to_establish_connection
|
449
|
+
|
450
|
+
Section: Class P0 - PL/pgSQL Error
|
451
|
+
|
452
|
+
# (PostgreSQL-specific error class)
|
453
|
+
P0000 E ERRCODE_PLPGSQL_ERROR plpgsql_error
|
454
|
+
P0001 E ERRCODE_RAISE_EXCEPTION raise_exception
|
455
|
+
P0002 E ERRCODE_NO_DATA_FOUND no_data_found
|
456
|
+
P0003 E ERRCODE_TOO_MANY_ROWS too_many_rows
|
457
|
+
|
458
|
+
Section: Class XX - Internal Error
|
459
|
+
|
460
|
+
# this is for "can't-happen" conditions and software bugs (PostgreSQL-specific error class)
|
461
|
+
XX000 E ERRCODE_INTERNAL_ERROR internal_error
|
462
|
+
XX001 E ERRCODE_DATA_CORRUPTED data_corrupted
|
463
|
+
XX002 E ERRCODE_INDEX_CORRUPTED index_corrupted
|
data/ext/extconf.rb
CHANGED
@@ -4,7 +4,11 @@ require 'mkmf'
|
|
4
4
|
|
5
5
|
if ENV['MAINTAINER_MODE']
|
6
6
|
$stderr.puts "Maintainer mode enabled."
|
7
|
-
$CFLAGS <<
|
7
|
+
$CFLAGS <<
|
8
|
+
' -Wall' <<
|
9
|
+
' -ggdb' <<
|
10
|
+
' -DDEBUG' <<
|
11
|
+
' -pedantic'
|
8
12
|
end
|
9
13
|
|
10
14
|
if pgdir = with_config( 'pg' )
|
@@ -15,6 +19,7 @@ if ENV['CROSS_COMPILING']
|
|
15
19
|
$LDFLAGS << " -L#{CONFIG['libdir']}"
|
16
20
|
|
17
21
|
# Link against all required libraries for static build, if they are available
|
22
|
+
have_library( 'crypt32', 'CertOpenStore' ) && append_library( $libs, 'crypt32' )
|
18
23
|
have_library( 'gdi32', 'CreateDC' ) && append_library( $libs, 'gdi32' )
|
19
24
|
have_library( 'secur32' ) && append_library( $libs, 'secur32' )
|
20
25
|
have_library( 'ws2_32', 'WSASocket') && append_library( $libs, 'ws2_32' )
|
@@ -22,19 +27,27 @@ if ENV['CROSS_COMPILING']
|
|
22
27
|
have_library( 'ssl', 'SSL_new' ) && append_library( $libs, 'ssl' )
|
23
28
|
end
|
24
29
|
|
25
|
-
dir_config 'pg'
|
26
|
-
|
27
30
|
if pgconfig = ( with_config('pg-config') || with_config('pg_config') || find_executable('pg_config') )
|
28
31
|
$stderr.puts "Using config values from %s" % [ pgconfig ]
|
29
|
-
|
30
|
-
|
32
|
+
incdir = `"#{pgconfig}" --includedir`.chomp
|
33
|
+
libdir = `"#{pgconfig}" --libdir`.chomp
|
34
|
+
dir_config 'pg', incdir, libdir
|
35
|
+
|
36
|
+
# Try to use runtime path linker option, even if RbConfig doesn't know about it.
|
37
|
+
# The rpath option is usually set implicit by dir_config(), but so far not
|
38
|
+
# on MacOS-X.
|
39
|
+
if RbConfig::CONFIG["RPATHFLAG"].to_s.empty? && try_link('int main() {return 0;}', " -Wl,-rpath,#{libdir}")
|
40
|
+
$LDFLAGS << " -Wl,-rpath,#{libdir}"
|
41
|
+
end
|
31
42
|
else
|
32
43
|
$stderr.puts "No pg_config... trying anyway. If building fails, please try again with",
|
33
44
|
" --with-pg-config=/path/to/pg_config"
|
45
|
+
dir_config 'pg'
|
34
46
|
end
|
35
47
|
|
36
48
|
find_header( 'libpq-fe.h' ) or abort "Can't find the 'libpq-fe.h header"
|
37
49
|
find_header( 'libpq/libpq-fs.h' ) or abort "Can't find the 'libpq/libpq-fs.h header"
|
50
|
+
find_header( 'pg_config_manual.h' ) or abort "Can't find the 'pg_config_manual.h' header"
|
38
51
|
|
39
52
|
abort "Can't find the PostgreSQL client library (libpq)" unless
|
40
53
|
have_library( 'pq', 'PQconnectdb', ['libpq-fe.h'] ) ||
|
@@ -42,25 +55,42 @@ abort "Can't find the PostgreSQL client library (libpq)" unless
|
|
42
55
|
have_library( 'ms/libpq', 'PQconnectdb', ['libpq-fe.h'] )
|
43
56
|
|
44
57
|
# optional headers/functions
|
45
|
-
have_func 'PQconnectionUsedPassword'
|
58
|
+
have_func 'PQconnectionUsedPassword' or
|
59
|
+
abort "Your PostgreSQL is too old. Either install an older version " +
|
60
|
+
"of this gem or upgrade your database."
|
46
61
|
have_func 'PQisthreadsafe'
|
47
62
|
have_func 'PQprepare'
|
48
63
|
have_func 'PQexecParams'
|
49
64
|
have_func 'PQescapeString'
|
50
65
|
have_func 'PQescapeStringConn'
|
66
|
+
have_func 'PQescapeLiteral'
|
67
|
+
have_func 'PQescapeIdentifier'
|
51
68
|
have_func 'PQgetCancel'
|
52
69
|
have_func 'lo_create'
|
53
70
|
have_func 'pg_encoding_to_char'
|
71
|
+
have_func 'pg_char_to_encoding'
|
54
72
|
have_func 'PQsetClientEncoding'
|
73
|
+
have_func 'PQlibVersion'
|
74
|
+
have_func 'PQping'
|
75
|
+
have_func 'PQsetSingleRowMode'
|
55
76
|
|
56
77
|
have_func 'rb_encdb_alias'
|
57
78
|
have_func 'rb_enc_alias'
|
79
|
+
have_func 'rb_thread_call_without_gvl'
|
80
|
+
have_func 'rb_thread_call_with_gvl'
|
81
|
+
have_func 'rb_thread_fd_select'
|
82
|
+
have_func 'rb_w32_wrap_io_handle'
|
83
|
+
|
84
|
+
have_const 'PGRES_COPY_BOTH', 'libpq-fe.h'
|
85
|
+
have_const 'PGRES_SINGLE_TUPLE', 'libpq-fe.h'
|
86
|
+
have_const 'PG_DIAG_TABLE_NAME', 'libpq-fe.h'
|
58
87
|
|
59
88
|
$defs.push( "-DHAVE_ST_NOTIFY_EXTRA" ) if
|
60
89
|
have_struct_member 'struct pgNotify', 'extra', 'libpq-fe.h'
|
61
90
|
|
62
91
|
# unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
|
63
|
-
have_header 'unistd.h'
|
92
|
+
have_header 'unistd.h'
|
93
|
+
have_header 'ruby/st.h' or have_header 'st.h' or abort "pg currently requires the ruby/st.h header"
|
64
94
|
|
65
95
|
create_header()
|
66
96
|
create_makefile( "pg_ext" )
|
data/ext/gvl_wrappers.c
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
/*
|
2
|
+
* gvl_wrappers.c - Wrapper functions for locking/unlocking the Ruby GVL
|
3
|
+
*
|
4
|
+
*/
|
5
|
+
|
6
|
+
#include "pg.h"
|
7
|
+
|
8
|
+
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_WRAPPER_STRUCT );
|
9
|
+
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_SKELETON );
|
10
|
+
FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB );
|
11
|
+
FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVL_WRAPPER_STRUCT );
|
12
|
+
FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVLCB_SKELETON );
|
13
|
+
FOR_EACH_CALLBACK_FUNCTION( DEFINE_GVLCB_STUB );
|
14
|
+
|
15
|
+
void ubf_cancel_running_command(void *c)
|
16
|
+
{
|
17
|
+
PGconn *conn = (PGconn*) c;
|
18
|
+
PQrequestCancel(conn);
|
19
|
+
}
|