pg 1.1.4 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ChangeLog +0 -6595
- data/History.rdoc +86 -0
- data/Manifest.txt +3 -2
- data/README-Windows.rdoc +4 -4
- data/README.ja.rdoc +1 -2
- data/README.rdoc +44 -9
- data/Rakefile +8 -6
- data/Rakefile.cross +57 -56
- data/ext/errorcodes.def +64 -0
- data/ext/errorcodes.txt +18 -2
- data/ext/extconf.rb +6 -6
- data/ext/pg.c +132 -95
- data/ext/pg.h +21 -18
- data/ext/pg_binary_decoder.c +9 -9
- data/ext/pg_binary_encoder.c +13 -12
- data/ext/pg_coder.c +21 -9
- data/ext/pg_connection.c +388 -298
- data/ext/pg_copy_coder.c +6 -3
- data/ext/pg_record_coder.c +491 -0
- data/ext/pg_result.c +279 -127
- data/ext/pg_text_decoder.c +14 -8
- data/ext/pg_text_encoder.c +180 -48
- data/ext/pg_tuple.c +14 -6
- data/ext/pg_type_map.c +1 -1
- data/ext/pg_type_map_all_strings.c +4 -4
- data/ext/pg_type_map_by_class.c +9 -4
- data/ext/pg_type_map_by_column.c +7 -6
- data/ext/pg_type_map_by_mri_type.c +1 -1
- data/ext/pg_type_map_by_oid.c +3 -2
- data/ext/pg_type_map_in_ruby.c +1 -1
- data/ext/{util.c → pg_util.c} +5 -5
- data/ext/{util.h → pg_util.h} +0 -0
- data/lib/pg.rb +4 -4
- data/lib/pg/basic_type_mapping.rb +81 -18
- data/lib/pg/binary_decoder.rb +1 -0
- data/lib/pg/coder.rb +22 -1
- data/lib/pg/connection.rb +2 -2
- data/lib/pg/constants.rb +1 -0
- data/lib/pg/exceptions.rb +1 -0
- data/lib/pg/result.rb +13 -1
- data/lib/pg/text_decoder.rb +2 -3
- data/lib/pg/text_encoder.rb +8 -18
- data/lib/pg/type_map_by_column.rb +2 -1
- data/spec/helpers.rb +11 -11
- data/spec/pg/basic_type_mapping_spec.rb +140 -18
- data/spec/pg/connection_spec.rb +166 -89
- data/spec/pg/result_spec.rb +194 -4
- data/spec/pg/tuple_spec.rb +55 -2
- data/spec/pg/type_map_by_class_spec.rb +1 -1
- data/spec/pg/type_map_by_column_spec.rb +5 -1
- data/spec/pg/type_map_by_oid_spec.rb +2 -2
- data/spec/pg/type_spec.rb +180 -6
- metadata +31 -30
- metadata.gz.sig +0 -0
data/ext/errorcodes.def
CHANGED
@@ -302,6 +302,66 @@
|
|
302
302
|
VALUE klass = define_error_class( "InvalidXmlProcessingInstruction", "22" );
|
303
303
|
register_error_class( "2200T", klass );
|
304
304
|
}
|
305
|
+
{
|
306
|
+
VALUE klass = define_error_class( "DuplicateJsonObjectKeyValue", "22" );
|
307
|
+
register_error_class( "22030", klass );
|
308
|
+
}
|
309
|
+
{
|
310
|
+
VALUE klass = define_error_class( "InvalidJsonText", "22" );
|
311
|
+
register_error_class( "22032", klass );
|
312
|
+
}
|
313
|
+
{
|
314
|
+
VALUE klass = define_error_class( "InvalidSqlJsonSubscript", "22" );
|
315
|
+
register_error_class( "22033", klass );
|
316
|
+
}
|
317
|
+
{
|
318
|
+
VALUE klass = define_error_class( "MoreThanOneSqlJsonItem", "22" );
|
319
|
+
register_error_class( "22034", klass );
|
320
|
+
}
|
321
|
+
{
|
322
|
+
VALUE klass = define_error_class( "NoSqlJsonItem", "22" );
|
323
|
+
register_error_class( "22035", klass );
|
324
|
+
}
|
325
|
+
{
|
326
|
+
VALUE klass = define_error_class( "NonNumericSqlJsonItem", "22" );
|
327
|
+
register_error_class( "22036", klass );
|
328
|
+
}
|
329
|
+
{
|
330
|
+
VALUE klass = define_error_class( "NonUniqueKeysInAJsonObject", "22" );
|
331
|
+
register_error_class( "22037", klass );
|
332
|
+
}
|
333
|
+
{
|
334
|
+
VALUE klass = define_error_class( "SingletonSqlJsonItemRequired", "22" );
|
335
|
+
register_error_class( "22038", klass );
|
336
|
+
}
|
337
|
+
{
|
338
|
+
VALUE klass = define_error_class( "SqlJsonArrayNotFound", "22" );
|
339
|
+
register_error_class( "22039", klass );
|
340
|
+
}
|
341
|
+
{
|
342
|
+
VALUE klass = define_error_class( "SqlJsonMemberNotFound", "22" );
|
343
|
+
register_error_class( "2203A", klass );
|
344
|
+
}
|
345
|
+
{
|
346
|
+
VALUE klass = define_error_class( "SqlJsonNumberNotFound", "22" );
|
347
|
+
register_error_class( "2203B", klass );
|
348
|
+
}
|
349
|
+
{
|
350
|
+
VALUE klass = define_error_class( "SqlJsonObjectNotFound", "22" );
|
351
|
+
register_error_class( "2203C", klass );
|
352
|
+
}
|
353
|
+
{
|
354
|
+
VALUE klass = define_error_class( "TooManyJsonArrayElements", "22" );
|
355
|
+
register_error_class( "2203D", klass );
|
356
|
+
}
|
357
|
+
{
|
358
|
+
VALUE klass = define_error_class( "TooManyJsonObjectMembers", "22" );
|
359
|
+
register_error_class( "2203E", klass );
|
360
|
+
}
|
361
|
+
{
|
362
|
+
VALUE klass = define_error_class( "SqlJsonScalarRequired", "22" );
|
363
|
+
register_error_class( "2203F", klass );
|
364
|
+
}
|
305
365
|
{
|
306
366
|
VALUE klass = define_error_class( "IntegrityConstraintViolation", NULL );
|
307
367
|
register_error_class( "23000", klass );
|
@@ -767,6 +827,10 @@
|
|
767
827
|
VALUE klass = define_error_class( "LockNotAvailable", "55" );
|
768
828
|
register_error_class( "55P03", klass );
|
769
829
|
}
|
830
|
+
{
|
831
|
+
VALUE klass = define_error_class( "UnsafeNewEnumValueUsage", "55" );
|
832
|
+
register_error_class( "55P04", klass );
|
833
|
+
}
|
770
834
|
{
|
771
835
|
VALUE klass = define_error_class( "OperatorIntervention", NULL );
|
772
836
|
register_error_class( "57000", klass );
|
data/ext/errorcodes.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# errcodes.txt
|
3
3
|
# PostgreSQL error codes
|
4
4
|
#
|
5
|
-
# Copyright (c) 2003-
|
5
|
+
# Copyright (c) 2003-2019, PostgreSQL Global Development Group
|
6
6
|
#
|
7
7
|
# This list serves as the basis for generating source files containing error
|
8
8
|
# codes. It is kept in a common format to make sure all these source files have
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# src/pl/tcl/pltclerrcodes.h
|
19
19
|
# the same, for PL/Tcl
|
20
20
|
#
|
21
|
-
# doc/src/sgml/errcodes-
|
21
|
+
# doc/src/sgml/errcodes-table.sgml
|
22
22
|
# a SGML table of error codes for inclusion in the documentation
|
23
23
|
#
|
24
24
|
# The format of this file is one error code per line, with the following
|
@@ -206,6 +206,21 @@ Section: Class 22 - Data Exception
|
|
206
206
|
2200N E ERRCODE_INVALID_XML_CONTENT invalid_xml_content
|
207
207
|
2200S E ERRCODE_INVALID_XML_COMMENT invalid_xml_comment
|
208
208
|
2200T E ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION invalid_xml_processing_instruction
|
209
|
+
22030 E ERRCODE_DUPLICATE_JSON_OBJECT_KEY_VALUE duplicate_json_object_key_value
|
210
|
+
22032 E ERRCODE_INVALID_JSON_TEXT invalid_json_text
|
211
|
+
22033 E ERRCODE_INVALID_SQL_JSON_SUBSCRIPT invalid_sql_json_subscript
|
212
|
+
22034 E ERRCODE_MORE_THAN_ONE_SQL_JSON_ITEM more_than_one_sql_json_item
|
213
|
+
22035 E ERRCODE_NO_SQL_JSON_ITEM no_sql_json_item
|
214
|
+
22036 E ERRCODE_NON_NUMERIC_SQL_JSON_ITEM non_numeric_sql_json_item
|
215
|
+
22037 E ERRCODE_NON_UNIQUE_KEYS_IN_A_JSON_OBJECT non_unique_keys_in_a_json_object
|
216
|
+
22038 E ERRCODE_SINGLETON_SQL_JSON_ITEM_REQUIRED singleton_sql_json_item_required
|
217
|
+
22039 E ERRCODE_SQL_JSON_ARRAY_NOT_FOUND sql_json_array_not_found
|
218
|
+
2203A E ERRCODE_SQL_JSON_MEMBER_NOT_FOUND sql_json_member_not_found
|
219
|
+
2203B E ERRCODE_SQL_JSON_NUMBER_NOT_FOUND sql_json_number_not_found
|
220
|
+
2203C E ERRCODE_SQL_JSON_OBJECT_NOT_FOUND sql_json_object_not_found
|
221
|
+
2203D E ERRCODE_TOO_MANY_JSON_ARRAY_ELEMENTS too_many_json_array_elements
|
222
|
+
2203E E ERRCODE_TOO_MANY_JSON_OBJECT_MEMBERS too_many_json_object_members
|
223
|
+
2203F E ERRCODE_SQL_JSON_SCALAR_REQUIRED sql_json_scalar_required
|
209
224
|
|
210
225
|
Section: Class 23 - Integrity Constraint Violation
|
211
226
|
|
@@ -401,6 +416,7 @@ Section: Class 55 - Object Not In Prerequisite State
|
|
401
416
|
55006 E ERRCODE_OBJECT_IN_USE object_in_use
|
402
417
|
55P02 E ERRCODE_CANT_CHANGE_RUNTIME_PARAM cant_change_runtime_param
|
403
418
|
55P03 E ERRCODE_LOCK_NOT_AVAILABLE lock_not_available
|
419
|
+
55P04 E ERRCODE_UNSAFE_NEW_ENUM_VALUE_USAGE unsafe_new_enum_value_usage
|
404
420
|
|
405
421
|
Section: Class 57 - Operator Intervention
|
406
422
|
|
data/ext/extconf.rb
CHANGED
@@ -73,13 +73,13 @@ end
|
|
73
73
|
have_func 'PQsetSingleRowMode' or
|
74
74
|
abort "Your PostgreSQL is too old. Either install an older version " +
|
75
75
|
"of this gem or upgrade your database to at least PostgreSQL-9.2."
|
76
|
-
have_func 'PQconninfo'
|
77
|
-
have_func 'PQsslAttribute'
|
78
|
-
have_func '
|
76
|
+
have_func 'PQconninfo' # since PostgreSQL-9.3
|
77
|
+
have_func 'PQsslAttribute' # since PostgreSQL-9.5
|
78
|
+
have_func 'PQresultVerboseErrorMessage' # since PostgreSQL-9.6
|
79
|
+
have_func 'PQencryptPasswordConn' # since PostgreSQL-10
|
80
|
+
have_func 'PQresultMemorySize' # since PostgreSQL-12
|
79
81
|
have_func 'timegm'
|
80
|
-
have_func 'rb_gc_adjust_memory_usage'
|
81
|
-
|
82
|
-
have_const 'PG_DIAG_TABLE_NAME', 'libpq-fe.h'
|
82
|
+
have_func 'rb_gc_adjust_memory_usage' # since ruby-2.4
|
83
83
|
|
84
84
|
# unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
|
85
85
|
have_header 'unistd.h'
|
data/ext/pg.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* pg.c - Toplevel extension
|
3
|
-
* $Id
|
3
|
+
* $Id$
|
4
4
|
*
|
5
5
|
* Author/s:
|
6
6
|
*
|
@@ -16,7 +16,7 @@
|
|
16
16
|
* See Contributors.rdoc for the many additional fine people that have contributed
|
17
17
|
* to this library over the years.
|
18
18
|
*
|
19
|
-
* Copyright (c) 1997-
|
19
|
+
* Copyright (c) 1997-2019 by the authors.
|
20
20
|
*
|
21
21
|
* You may redistribute this software under the same terms as Ruby itself; see
|
22
22
|
* https://www.ruby-lang.org/en/about/license.txt or the BSDL file in the source
|
@@ -331,8 +331,7 @@ pg_to_bool_int(VALUE value)
|
|
331
331
|
* If your application initializes libssl and/or libcrypto libraries and libpq is
|
332
332
|
* built with SSL support, you should call PG.init_openssl() to tell libpq that the
|
333
333
|
* libssl and/or libcrypto libraries have been initialized by your application,
|
334
|
-
* so that libpq will not also initialize those libraries.
|
335
|
-
* http://h71000.www7.hp.com/doc/83final/BA554_90007/ch04.html for details on the SSL API.
|
334
|
+
* so that libpq will not also initialize those libraries.
|
336
335
|
*
|
337
336
|
* When do_ssl is +true+, libpq will initialize the OpenSSL library before first
|
338
337
|
* opening a database connection. When do_crypto is +true+, the libcrypto library
|
@@ -422,7 +421,7 @@ Init_pg_ext()
|
|
422
421
|
rb_define_const(rb_mPGconstants, "CONNECTION_SSL_STARTUP", INT2FIX(CONNECTION_SSL_STARTUP));
|
423
422
|
/* Negotiating environment-driven parameter settings. */
|
424
423
|
rb_define_const(rb_mPGconstants, "CONNECTION_SETENV", INT2FIX(CONNECTION_SETENV));
|
425
|
-
/* Internal state
|
424
|
+
/* Internal state - PG.connect() needed. */
|
426
425
|
rb_define_const(rb_mPGconstants, "CONNECTION_NEEDED", INT2FIX(CONNECTION_NEEDED));
|
427
426
|
|
428
427
|
/****** PG::Connection CLASS CONSTANTS: Nonblocking connection polling status ******/
|
@@ -438,26 +437,48 @@ Init_pg_ext()
|
|
438
437
|
|
439
438
|
/****** PG::Connection CLASS CONSTANTS: Transaction Status ******/
|
440
439
|
|
441
|
-
/* Transaction is currently idle (#transaction_status) */
|
440
|
+
/* Transaction is currently idle ( Connection#transaction_status ) */
|
442
441
|
rb_define_const(rb_mPGconstants, "PQTRANS_IDLE", INT2FIX(PQTRANS_IDLE));
|
443
|
-
/* Transaction is currently active; query has been sent to the server, but not yet completed. (#transaction_status) */
|
442
|
+
/* Transaction is currently active; query has been sent to the server, but not yet completed. ( Connection#transaction_status ) */
|
444
443
|
rb_define_const(rb_mPGconstants, "PQTRANS_ACTIVE", INT2FIX(PQTRANS_ACTIVE));
|
445
|
-
/* Transaction is currently idle, in a valid transaction block (#transaction_status) */
|
444
|
+
/* Transaction is currently idle, in a valid transaction block ( Connection#transaction_status ) */
|
446
445
|
rb_define_const(rb_mPGconstants, "PQTRANS_INTRANS", INT2FIX(PQTRANS_INTRANS));
|
447
|
-
/* Transaction is currently idle, in a failed transaction block (#transaction_status) */
|
446
|
+
/* Transaction is currently idle, in a failed transaction block ( Connection#transaction_status ) */
|
448
447
|
rb_define_const(rb_mPGconstants, "PQTRANS_INERROR", INT2FIX(PQTRANS_INERROR));
|
449
|
-
/* Transaction's connection is bad (#transaction_status) */
|
448
|
+
/* Transaction's connection is bad ( Connection#transaction_status ) */
|
450
449
|
rb_define_const(rb_mPGconstants, "PQTRANS_UNKNOWN", INT2FIX(PQTRANS_UNKNOWN));
|
451
450
|
|
452
451
|
/****** PG::Connection CLASS CONSTANTS: Error Verbosity ******/
|
453
452
|
|
454
|
-
/*
|
453
|
+
/* Error verbosity level ( Connection#set_error_verbosity ).
|
454
|
+
* In TERSE mode, returned messages include severity, primary text, and position only; this will normally fit on a single line. */
|
455
455
|
rb_define_const(rb_mPGconstants, "PQERRORS_TERSE", INT2FIX(PQERRORS_TERSE));
|
456
|
-
/*
|
456
|
+
/* Error verbosity level ( Connection#set_error_verbosity ).
|
457
|
+
* The DEFAULT mode produces messages that include the above plus any detail, hint, or context fields (these might span multiple lines). */
|
457
458
|
rb_define_const(rb_mPGconstants, "PQERRORS_DEFAULT", INT2FIX(PQERRORS_DEFAULT));
|
458
|
-
/*
|
459
|
+
/* Error verbosity level ( Connection#set_error_verbosity ).
|
460
|
+
* The VERBOSE mode includes all available fields. */
|
459
461
|
rb_define_const(rb_mPGconstants, "PQERRORS_VERBOSE", INT2FIX(PQERRORS_VERBOSE));
|
460
462
|
|
463
|
+
/* PQERRORS_SQLSTATE was introduced in PG-12 together with PQresultMemorySize() */
|
464
|
+
#ifdef HAVE_PQRESULTMEMORYSIZE
|
465
|
+
/* Error verbosity level ( Connection#set_error_verbosity ).
|
466
|
+
* The SQLSTATE mode includes only the error severity and the SQLSTATE error code, if one is available (if not, the output is like TERSE mode).
|
467
|
+
*
|
468
|
+
* Available since PostgreSQL-12.
|
469
|
+
*/
|
470
|
+
rb_define_const(rb_mPGconstants, "PQERRORS_SQLSTATE", INT2FIX(PQERRORS_SQLSTATE));
|
471
|
+
#endif
|
472
|
+
|
473
|
+
#ifdef HAVE_PQRESULTVERBOSEERRORMESSAGE
|
474
|
+
/* See Connection#set_error_context_visibility */
|
475
|
+
rb_define_const(rb_mPGconstants, "PQSHOW_CONTEXT_NEVER", INT2FIX(PQSHOW_CONTEXT_NEVER));
|
476
|
+
/* See Connection#set_error_context_visibility */
|
477
|
+
rb_define_const(rb_mPGconstants, "PQSHOW_CONTEXT_ERRORS", INT2FIX(PQSHOW_CONTEXT_ERRORS));
|
478
|
+
/* See Connection#set_error_context_visibility */
|
479
|
+
rb_define_const(rb_mPGconstants, "PQSHOW_CONTEXT_ALWAYS", INT2FIX(PQSHOW_CONTEXT_ALWAYS));
|
480
|
+
#endif
|
481
|
+
|
461
482
|
/****** PG::Connection CLASS CONSTANTS: Check Server Status ******/
|
462
483
|
|
463
484
|
/* Server is accepting connections. */
|
@@ -471,141 +492,156 @@ Init_pg_ext()
|
|
471
492
|
|
472
493
|
/****** PG::Connection CLASS CONSTANTS: Large Objects ******/
|
473
494
|
|
474
|
-
/* Flag for #lo_creat, #lo_open -- open for writing */
|
495
|
+
/* Flag for Connection#lo_creat, Connection#lo_open -- open for writing */
|
475
496
|
rb_define_const(rb_mPGconstants, "INV_WRITE", INT2FIX(INV_WRITE));
|
476
|
-
/* Flag for #lo_creat, #lo_open -- open for reading */
|
497
|
+
/* Flag for Connection#lo_creat, Connection#lo_open -- open for reading */
|
477
498
|
rb_define_const(rb_mPGconstants, "INV_READ", INT2FIX(INV_READ));
|
478
|
-
/* Flag for #lo_lseek -- seek from object start */
|
499
|
+
/* Flag for Connection#lo_lseek -- seek from object start */
|
479
500
|
rb_define_const(rb_mPGconstants, "SEEK_SET", INT2FIX(SEEK_SET));
|
480
|
-
/* Flag for #lo_lseek -- seek from current position */
|
501
|
+
/* Flag for Connection#lo_lseek -- seek from current position */
|
481
502
|
rb_define_const(rb_mPGconstants, "SEEK_CUR", INT2FIX(SEEK_CUR));
|
482
|
-
/* Flag for #lo_lseek -- seek from object end */
|
503
|
+
/* Flag for Connection#lo_lseek -- seek from object end */
|
483
504
|
rb_define_const(rb_mPGconstants, "SEEK_END", INT2FIX(SEEK_END));
|
484
505
|
|
485
506
|
/****** PG::Result CONSTANTS: result status ******/
|
486
507
|
|
487
|
-
/* #result_status constant
|
508
|
+
/* Result#result_status constant - The string sent to the server was empty. */
|
488
509
|
rb_define_const(rb_mPGconstants, "PGRES_EMPTY_QUERY", INT2FIX(PGRES_EMPTY_QUERY));
|
489
|
-
/* #result_status constant
|
510
|
+
/* Result#result_status constant - Successful completion of a command returning no data. */
|
490
511
|
rb_define_const(rb_mPGconstants, "PGRES_COMMAND_OK", INT2FIX(PGRES_COMMAND_OK));
|
491
|
-
|
492
|
-
(such as a SELECT or SHOW). */
|
512
|
+
/* Result#result_status constant - Successful completion of a command returning data (such as a SELECT or SHOW). */
|
493
513
|
rb_define_const(rb_mPGconstants, "PGRES_TUPLES_OK", INT2FIX(PGRES_TUPLES_OK));
|
494
|
-
/* #result_status constant
|
514
|
+
/* Result#result_status constant - Copy Out (from server) data transfer started. */
|
495
515
|
rb_define_const(rb_mPGconstants, "PGRES_COPY_OUT", INT2FIX(PGRES_COPY_OUT));
|
496
|
-
/* #result_status constant
|
516
|
+
/* Result#result_status constant - Copy In (to server) data transfer started. */
|
497
517
|
rb_define_const(rb_mPGconstants, "PGRES_COPY_IN", INT2FIX(PGRES_COPY_IN));
|
498
|
-
/* #result_status constant
|
518
|
+
/* Result#result_status constant - The server’s response was not understood. */
|
499
519
|
rb_define_const(rb_mPGconstants, "PGRES_BAD_RESPONSE", INT2FIX(PGRES_BAD_RESPONSE));
|
500
|
-
/* #result_status constant
|
520
|
+
/* Result#result_status constant - A nonfatal error (a notice or warning) occurred. */
|
501
521
|
rb_define_const(rb_mPGconstants, "PGRES_NONFATAL_ERROR",INT2FIX(PGRES_NONFATAL_ERROR));
|
502
|
-
/* #result_status constant
|
522
|
+
/* Result#result_status constant - A fatal error occurred. */
|
503
523
|
rb_define_const(rb_mPGconstants, "PGRES_FATAL_ERROR", INT2FIX(PGRES_FATAL_ERROR));
|
504
|
-
/* #result_status constant
|
524
|
+
/* Result#result_status constant - Copy In/Out data transfer in progress. */
|
505
525
|
rb_define_const(rb_mPGconstants, "PGRES_COPY_BOTH", INT2FIX(PGRES_COPY_BOTH));
|
506
|
-
/* #result_status constant
|
526
|
+
/* Result#result_status constant - Single tuple from larger resultset. */
|
507
527
|
rb_define_const(rb_mPGconstants, "PGRES_SINGLE_TUPLE", INT2FIX(PGRES_SINGLE_TUPLE));
|
508
528
|
|
509
529
|
/****** Result CONSTANTS: result error field codes ******/
|
510
530
|
|
511
|
-
/* #result_error_field argument constant
|
512
|
-
*
|
513
|
-
* DEBUG, INFO, or LOG (in a notice message), or a localized translation
|
514
|
-
* of one of these.
|
531
|
+
/* Result#result_error_field argument constant
|
532
|
+
*
|
533
|
+
* The severity; the field contents are ERROR, FATAL, or PANIC (in an error message), or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message), or a localized translation
|
534
|
+
* of one of these.
|
535
|
+
* Always present.
|
515
536
|
*/
|
516
537
|
rb_define_const(rb_mPGconstants, "PG_DIAG_SEVERITY", INT2FIX(PG_DIAG_SEVERITY));
|
517
538
|
|
518
|
-
|
519
|
-
|
520
|
-
*
|
521
|
-
*
|
522
|
-
*
|
523
|
-
*
|
539
|
+
#ifdef PG_DIAG_SEVERITY_NONLOCALIZED
|
540
|
+
/* Result#result_error_field argument constant
|
541
|
+
*
|
542
|
+
* The severity; the field contents are ERROR, FATAL, or PANIC (in an error message), or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message).
|
543
|
+
* This is identical to the PG_DIAG_SEVERITY field except that the contents are never localized.
|
544
|
+
*
|
545
|
+
* Available since PostgreSQL-9.6
|
546
|
+
*/
|
547
|
+
rb_define_const(rb_mPGconstants, "PG_DIAG_SEVERITY_NONLOCALIZED", INT2FIX(PG_DIAG_SEVERITY_NONLOCALIZED));
|
548
|
+
#endif
|
549
|
+
/* Result#result_error_field argument constant
|
550
|
+
*
|
551
|
+
* The SQLSTATE code for the error.
|
552
|
+
* The SQLSTATE code identies the type of error that has occurred; it can be used by front-end applications to perform specic operations (such as error handling) in response to a particular database error.
|
553
|
+
* For a list of the possible SQLSTATE codes, see Appendix A.
|
554
|
+
* This field is not localizable, and is always present.
|
524
555
|
*/
|
525
556
|
rb_define_const(rb_mPGconstants, "PG_DIAG_SQLSTATE", INT2FIX(PG_DIAG_SQLSTATE));
|
526
|
-
|
527
|
-
|
528
|
-
* error message (typically one line).
|
557
|
+
/* Result#result_error_field argument constant
|
558
|
+
*
|
559
|
+
* The primary human-readable error message (typically one line).
|
560
|
+
* Always present. */
|
529
561
|
rb_define_const(rb_mPGconstants, "PG_DIAG_MESSAGE_PRIMARY", INT2FIX(PG_DIAG_MESSAGE_PRIMARY));
|
530
|
-
|
531
|
-
|
532
|
-
* error message carrying more detail about the problem.
|
533
|
-
* multiple lines.
|
562
|
+
/* Result#result_error_field argument constant
|
563
|
+
*
|
564
|
+
* Detail: an optional secondary error message carrying more detail about the problem.
|
565
|
+
* Might run to multiple lines.
|
534
566
|
*/
|
535
567
|
rb_define_const(rb_mPGconstants, "PG_DIAG_MESSAGE_DETAIL", INT2FIX(PG_DIAG_MESSAGE_DETAIL));
|
536
|
-
|
537
|
-
|
538
|
-
* what to do about the problem.
|
539
|
-
* in that it offers advice (potentially inappropriate) rather than
|
540
|
-
*
|
568
|
+
/* Result#result_error_field argument constant
|
569
|
+
*
|
570
|
+
* Hint: an optional suggestion what to do about the problem.
|
571
|
+
* This is intended to differ from detail in that it offers advice (potentially inappropriate) rather than hard facts.
|
572
|
+
* Might run to multiple lines.
|
541
573
|
*/
|
542
|
-
|
543
574
|
rb_define_const(rb_mPGconstants, "PG_DIAG_MESSAGE_HINT", INT2FIX(PG_DIAG_MESSAGE_HINT));
|
544
|
-
/* #result_error_field argument constant
|
545
|
-
*
|
546
|
-
*
|
547
|
-
*
|
575
|
+
/* Result#result_error_field argument constant
|
576
|
+
*
|
577
|
+
* A string containing a decimal integer indicating an error cursor position as an index into the original statement string.
|
578
|
+
*
|
579
|
+
* The first character has index 1, and positions are measured in characters not bytes.
|
548
580
|
*/
|
549
|
-
|
550
581
|
rb_define_const(rb_mPGconstants, "PG_DIAG_STATEMENT_POSITION", INT2FIX(PG_DIAG_STATEMENT_POSITION));
|
551
|
-
/* #result_error_field argument constant
|
552
|
-
*
|
553
|
-
* position refers to an internally generated command rather than the
|
554
|
-
*
|
555
|
-
* always appear when this eld appears.
|
582
|
+
/* Result#result_error_field argument constant
|
583
|
+
*
|
584
|
+
* This is defined the same as the PG_DIAG_STATEMENT_POSITION field, but it is used when the cursor position refers to an internally generated command rather than the one submitted by the client.
|
585
|
+
* The PG_DIAG_INTERNAL_QUERY field will always appear when this field appears.
|
556
586
|
*/
|
557
|
-
|
558
587
|
rb_define_const(rb_mPGconstants, "PG_DIAG_INTERNAL_POSITION", INT2FIX(PG_DIAG_INTERNAL_POSITION));
|
559
|
-
/* #result_error_field argument constant
|
560
|
-
*
|
561
|
-
*
|
588
|
+
/* Result#result_error_field argument constant
|
589
|
+
*
|
590
|
+
* The text of a failed internally-generated command.
|
591
|
+
* This could be, for example, a SQL query issued by a PL/pgSQL function.
|
562
592
|
*/
|
563
|
-
|
564
593
|
rb_define_const(rb_mPGconstants, "PG_DIAG_INTERNAL_QUERY", INT2FIX(PG_DIAG_INTERNAL_QUERY));
|
565
|
-
/* #result_error_field argument constant
|
566
|
-
*
|
567
|
-
*
|
568
|
-
*
|
594
|
+
/* Result#result_error_field argument constant
|
595
|
+
*
|
596
|
+
* An indication of the context in which the error occurred.
|
597
|
+
* Presently this includes a call stack traceback of active procedural language functions and internally-generated queries.
|
598
|
+
* The trace is one entry per line, most recent first.
|
569
599
|
*/
|
570
|
-
|
571
600
|
rb_define_const(rb_mPGconstants, "PG_DIAG_CONTEXT", INT2FIX(PG_DIAG_CONTEXT));
|
572
|
-
/* #result_error_field argument constant
|
573
|
-
*
|
601
|
+
/* Result#result_error_field argument constant
|
602
|
+
*
|
603
|
+
* The file name of the source-code location where the error was reported. */
|
574
604
|
rb_define_const(rb_mPGconstants, "PG_DIAG_SOURCE_FILE", INT2FIX(PG_DIAG_SOURCE_FILE));
|
575
605
|
|
576
|
-
/* #result_error_field argument constant
|
577
|
-
*
|
606
|
+
/* Result#result_error_field argument constant
|
607
|
+
*
|
608
|
+
* The line number of the source-code location where the error was reported. */
|
578
609
|
rb_define_const(rb_mPGconstants, "PG_DIAG_SOURCE_LINE", INT2FIX(PG_DIAG_SOURCE_LINE));
|
579
610
|
|
580
|
-
/* #result_error_field argument constant
|
581
|
-
*
|
611
|
+
/* Result#result_error_field argument constant
|
612
|
+
*
|
613
|
+
* The name of the source-code function reporting the error. */
|
582
614
|
rb_define_const(rb_mPGconstants, "PG_DIAG_SOURCE_FUNCTION", INT2FIX(PG_DIAG_SOURCE_FUNCTION));
|
583
615
|
|
584
|
-
#ifdef
|
585
|
-
/* #result_error_field argument constant
|
586
|
-
*
|
616
|
+
#ifdef PG_DIAG_TABLE_NAME
|
617
|
+
/* Result#result_error_field argument constant
|
618
|
+
*
|
619
|
+
* If the error was associated with a specific database object, the name of the schema containing that object, if any. */
|
587
620
|
rb_define_const(rb_mPGconstants, "PG_DIAG_SCHEMA_NAME", INT2FIX(PG_DIAG_SCHEMA_NAME));
|
588
621
|
|
589
|
-
/* #result_error_field argument constant
|
590
|
-
*
|
591
|
-
*
|
622
|
+
/* Result#result_error_field argument constant
|
623
|
+
*
|
624
|
+
* If the error was associated with a specific table, the name of the table.
|
625
|
+
* (When this field is present, the schema name field provides the name of the table's schema.) */
|
592
626
|
rb_define_const(rb_mPGconstants, "PG_DIAG_TABLE_NAME", INT2FIX(PG_DIAG_TABLE_NAME));
|
593
627
|
|
594
|
-
/* #result_error_field argument constant
|
595
|
-
*
|
596
|
-
*
|
628
|
+
/* Result#result_error_field argument constant
|
629
|
+
*
|
630
|
+
* If the error was associated with a specific table column, the name of the column.
|
631
|
+
* (When this field is present, the schema and table name fields identify the table.) */
|
597
632
|
rb_define_const(rb_mPGconstants, "PG_DIAG_COLUMN_NAME", INT2FIX(PG_DIAG_COLUMN_NAME));
|
598
633
|
|
599
|
-
/* #result_error_field argument constant
|
600
|
-
*
|
601
|
-
*
|
634
|
+
/* Result#result_error_field argument constant
|
635
|
+
*
|
636
|
+
* If the error was associated with a specific datatype, the name of the datatype.
|
637
|
+
* (When this field is present, the schema name field provides the name of the datatype's schema.) */
|
602
638
|
rb_define_const(rb_mPGconstants, "PG_DIAG_DATATYPE_NAME", INT2FIX(PG_DIAG_DATATYPE_NAME));
|
603
639
|
|
604
|
-
/* #result_error_field argument constant
|
605
|
-
*
|
606
|
-
*
|
607
|
-
*
|
608
|
-
* constraint syntax.) */
|
640
|
+
/* Result#result_error_field argument constant
|
641
|
+
*
|
642
|
+
* If the error was associated with a specific constraint, the name of the constraint.
|
643
|
+
* The table or domain that the constraint belongs to is reported using the fields listed above.
|
644
|
+
* (For this purpose, indexes are treated as constraints, even if they weren't created with constraint syntax.) */
|
609
645
|
rb_define_const(rb_mPGconstants, "PG_DIAG_CONSTRAINT_NAME", INT2FIX(PG_DIAG_CONSTRAINT_NAME));
|
610
646
|
#endif
|
611
647
|
|
@@ -635,6 +671,7 @@ Init_pg_ext()
|
|
635
671
|
init_pg_binary_encoder();
|
636
672
|
init_pg_binary_decoder();
|
637
673
|
init_pg_copycoder();
|
674
|
+
init_pg_recordcoder();
|
638
675
|
init_pg_tuple();
|
639
676
|
}
|
640
677
|
|