pg 0.17.1 → 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 +5 -5
 - checksums.yaml.gz.sig +0 -0
 - data/BSDL +2 -2
 - data/ChangeLog +0 -3506
 - data/History.rdoc +308 -0
 - data/Manifest.txt +35 -19
 - data/README-Windows.rdoc +17 -28
 - data/README.ja.rdoc +1 -2
 - data/README.rdoc +113 -14
 - data/Rakefile +67 -30
 - data/Rakefile.cross +109 -83
 - data/ext/errorcodes.def +101 -0
 - data/ext/errorcodes.rb +1 -1
 - data/ext/errorcodes.txt +33 -2
 - data/ext/extconf.rb +55 -58
 - data/ext/gvl_wrappers.c +4 -0
 - data/ext/gvl_wrappers.h +27 -39
 - data/ext/pg.c +262 -130
 - data/ext/pg.h +266 -54
 - data/ext/pg_binary_decoder.c +229 -0
 - data/ext/pg_binary_encoder.c +163 -0
 - data/ext/pg_coder.c +561 -0
 - data/ext/pg_connection.c +1689 -990
 - data/ext/pg_copy_coder.c +599 -0
 - data/ext/pg_errors.c +6 -0
 - data/ext/pg_record_coder.c +491 -0
 - data/ext/pg_result.c +897 -164
 - data/ext/pg_text_decoder.c +987 -0
 - data/ext/pg_text_encoder.c +814 -0
 - data/ext/pg_tuple.c +549 -0
 - data/ext/pg_type_map.c +166 -0
 - data/ext/pg_type_map_all_strings.c +116 -0
 - data/ext/pg_type_map_by_class.c +244 -0
 - data/ext/pg_type_map_by_column.c +313 -0
 - data/ext/pg_type_map_by_mri_type.c +284 -0
 - data/ext/pg_type_map_by_oid.c +356 -0
 - data/ext/pg_type_map_in_ruby.c +299 -0
 - data/ext/pg_util.c +149 -0
 - data/ext/pg_util.h +65 -0
 - data/lib/pg/basic_type_mapping.rb +522 -0
 - data/lib/pg/binary_decoder.rb +23 -0
 - data/lib/pg/coder.rb +104 -0
 - data/lib/pg/connection.rb +153 -41
 - data/lib/pg/constants.rb +2 -1
 - data/lib/pg/exceptions.rb +2 -1
 - data/lib/pg/result.rb +33 -6
 - data/lib/pg/text_decoder.rb +46 -0
 - data/lib/pg/text_encoder.rb +59 -0
 - data/lib/pg/tuple.rb +30 -0
 - data/lib/pg/type_map_by_column.rb +16 -0
 - data/lib/pg.rb +29 -9
 - data/spec/{lib/helpers.rb → helpers.rb} +151 -64
 - data/spec/pg/basic_type_mapping_spec.rb +630 -0
 - data/spec/pg/connection_spec.rb +1180 -477
 - data/spec/pg/connection_sync_spec.rb +41 -0
 - data/spec/pg/result_spec.rb +456 -120
 - data/spec/pg/tuple_spec.rb +333 -0
 - data/spec/pg/type_map_by_class_spec.rb +138 -0
 - data/spec/pg/type_map_by_column_spec.rb +226 -0
 - data/spec/pg/type_map_by_mri_type_spec.rb +136 -0
 - data/spec/pg/type_map_by_oid_spec.rb +149 -0
 - data/spec/pg/type_map_in_ruby_spec.rb +164 -0
 - data/spec/pg/type_map_spec.rb +22 -0
 - data/spec/pg/type_spec.rb +1123 -0
 - data/spec/pg_spec.rb +26 -20
 - data.tar.gz.sig +0 -0
 - metadata +148 -91
 - metadata.gz.sig +0 -0
 - data/sample/array_insert.rb +0 -20
 - data/sample/async_api.rb +0 -106
 - data/sample/async_copyto.rb +0 -39
 - data/sample/async_mixed.rb +0 -56
 - data/sample/check_conn.rb +0 -21
 - data/sample/copyfrom.rb +0 -81
 - data/sample/copyto.rb +0 -19
 - data/sample/cursor.rb +0 -21
 - data/sample/disk_usage_report.rb +0 -186
 - data/sample/issue-119.rb +0 -94
 - data/sample/losample.rb +0 -69
 - data/sample/minimal-testcase.rb +0 -17
 - data/sample/notify_wait.rb +0 -72
 - data/sample/pg_statistics.rb +0 -294
 - data/sample/replication_monitor.rb +0 -231
 - data/sample/test_binary_values.rb +0 -33
 - data/sample/wal_shipper.rb +0 -434
 - data/sample/warehouse_partitions.rb +0 -320
 
    
        data/ext/errorcodes.def
    CHANGED
    
    | 
         @@ -186,6 +186,10 @@ 
     | 
|
| 
       186 
186 
     | 
    
         
             
              VALUE klass = define_error_class( "InvalidParameterValue", "22" );
         
     | 
| 
       187 
187 
     | 
    
         
             
              register_error_class( "22023", klass );
         
     | 
| 
       188 
188 
     | 
    
         
             
            }
         
     | 
| 
      
 189 
     | 
    
         
            +
            {
         
     | 
| 
      
 190 
     | 
    
         
            +
              VALUE klass = define_error_class( "InvalidPrecedingOrFollowingSize", "22" );
         
     | 
| 
      
 191 
     | 
    
         
            +
              register_error_class( "22013", klass );
         
     | 
| 
      
 192 
     | 
    
         
            +
            }
         
     | 
| 
       189 
193 
     | 
    
         
             
            {
         
     | 
| 
       190 
194 
     | 
    
         
             
              VALUE klass = define_error_class( "InvalidRegularExpression", "22" );
         
     | 
| 
       191 
195 
     | 
    
         
             
              register_error_class( "2201B", klass );
         
     | 
| 
         @@ -198,6 +202,14 @@ 
     | 
|
| 
       198 
202 
     | 
    
         
             
              VALUE klass = define_error_class( "InvalidRowCountInResultOffsetClause", "22" );
         
     | 
| 
       199 
203 
     | 
    
         
             
              register_error_class( "2201X", klass );
         
     | 
| 
       200 
204 
     | 
    
         
             
            }
         
     | 
| 
      
 205 
     | 
    
         
            +
            {
         
     | 
| 
      
 206 
     | 
    
         
            +
              VALUE klass = define_error_class( "InvalidTablesampleArgument", "22" );
         
     | 
| 
      
 207 
     | 
    
         
            +
              register_error_class( "2202H", klass );
         
     | 
| 
      
 208 
     | 
    
         
            +
            }
         
     | 
| 
      
 209 
     | 
    
         
            +
            {
         
     | 
| 
      
 210 
     | 
    
         
            +
              VALUE klass = define_error_class( "InvalidTablesampleRepeat", "22" );
         
     | 
| 
      
 211 
     | 
    
         
            +
              register_error_class( "2202G", klass );
         
     | 
| 
      
 212 
     | 
    
         
            +
            }
         
     | 
| 
       201 
213 
     | 
    
         
             
            {
         
     | 
| 
       202 
214 
     | 
    
         
             
              VALUE klass = define_error_class( "InvalidTimeZoneDisplacementValue", "22" );
         
     | 
| 
       203 
215 
     | 
    
         
             
              register_error_class( "22009", klass );
         
     | 
| 
         @@ -222,6 +234,10 @@ 
     | 
|
| 
       222 
234 
     | 
    
         
             
              VALUE klass = define_error_class( "NumericValueOutOfRange", "22" );
         
     | 
| 
       223 
235 
     | 
    
         
             
              register_error_class( "22003", klass );
         
     | 
| 
       224 
236 
     | 
    
         
             
            }
         
     | 
| 
      
 237 
     | 
    
         
            +
            {
         
     | 
| 
      
 238 
     | 
    
         
            +
              VALUE klass = define_error_class( "SequenceGeneratorLimitExceeded", "22" );
         
     | 
| 
      
 239 
     | 
    
         
            +
              register_error_class( "2200H", klass );
         
     | 
| 
      
 240 
     | 
    
         
            +
            }
         
     | 
| 
       225 
241 
     | 
    
         
             
            {
         
     | 
| 
       226 
242 
     | 
    
         
             
              VALUE klass = define_error_class( "StringDataLengthMismatch", "22" );
         
     | 
| 
       227 
243 
     | 
    
         
             
              register_error_class( "22026", klass );
         
     | 
| 
         @@ -286,6 +302,66 @@ 
     | 
|
| 
       286 
302 
     | 
    
         
             
              VALUE klass = define_error_class( "InvalidXmlProcessingInstruction", "22" );
         
     | 
| 
       287 
303 
     | 
    
         
             
              register_error_class( "2200T", klass );
         
     | 
| 
       288 
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 
     | 
    
         
            +
            }
         
     | 
| 
       289 
365 
     | 
    
         
             
            {
         
     | 
| 
       290 
366 
     | 
    
         
             
              VALUE klass = define_error_class( "IntegrityConstraintViolation", NULL );
         
     | 
| 
       291 
367 
     | 
    
         
             
              register_error_class( "23000", klass );
         
     | 
| 
         @@ -365,6 +441,10 @@ 
     | 
|
| 
       365 
441 
     | 
    
         
             
              VALUE klass = define_error_class( "InFailedSqlTransaction", "25" );
         
     | 
| 
       366 
442 
     | 
    
         
             
              register_error_class( "25P02", klass );
         
     | 
| 
       367 
443 
     | 
    
         
             
            }
         
     | 
| 
      
 444 
     | 
    
         
            +
            {
         
     | 
| 
      
 445 
     | 
    
         
            +
              VALUE klass = define_error_class( "IdleInTransactionSessionTimeout", "25" );
         
     | 
| 
      
 446 
     | 
    
         
            +
              register_error_class( "25P03", klass );
         
     | 
| 
      
 447 
     | 
    
         
            +
            }
         
     | 
| 
       368 
448 
     | 
    
         
             
            {
         
     | 
| 
       369 
449 
     | 
    
         
             
              VALUE klass = define_error_class( "InvalidSqlStatementName", NULL );
         
     | 
| 
       370 
450 
     | 
    
         
             
              register_error_class( "26000", klass );
         
     | 
| 
         @@ -466,6 +546,10 @@ 
     | 
|
| 
       466 
546 
     | 
    
         
             
              VALUE klass = define_error_class( "ERIESrfProtocolViolated", "39" );
         
     | 
| 
       467 
547 
     | 
    
         
             
              register_error_class( "39P02", klass );
         
     | 
| 
       468 
548 
     | 
    
         
             
            }
         
     | 
| 
      
 549 
     | 
    
         
            +
            {
         
     | 
| 
      
 550 
     | 
    
         
            +
              VALUE klass = define_error_class( "ERIEEventTriggerProtocolViolated", "39" );
         
     | 
| 
      
 551 
     | 
    
         
            +
              register_error_class( "39P03", klass );
         
     | 
| 
      
 552 
     | 
    
         
            +
            }
         
     | 
| 
       469 
553 
     | 
    
         
             
            {
         
     | 
| 
       470 
554 
     | 
    
         
             
              VALUE klass = define_error_class( "SavepointException", NULL );
         
     | 
| 
       471 
555 
     | 
    
         
             
              register_error_class( "3B000", klass );
         
     | 
| 
         @@ -571,6 +655,10 @@ 
     | 
|
| 
       571 
655 
     | 
    
         
             
              VALUE klass = define_error_class( "WrongObjectType", "42" );
         
     | 
| 
       572 
656 
     | 
    
         
             
              register_error_class( "42809", klass );
         
     | 
| 
       573 
657 
     | 
    
         
             
            }
         
     | 
| 
      
 658 
     | 
    
         
            +
            {
         
     | 
| 
      
 659 
     | 
    
         
            +
              VALUE klass = define_error_class( "GeneratedAlways", "42" );
         
     | 
| 
      
 660 
     | 
    
         
            +
              register_error_class( "428C9", klass );
         
     | 
| 
      
 661 
     | 
    
         
            +
            }
         
     | 
| 
       574 
662 
     | 
    
         
             
            {
         
     | 
| 
       575 
663 
     | 
    
         
             
              VALUE klass = define_error_class( "UndefinedColumn", "42" );
         
     | 
| 
       576 
664 
     | 
    
         
             
              register_error_class( "42703", klass );
         
     | 
| 
         @@ -739,6 +827,10 @@ 
     | 
|
| 
       739 
827 
     | 
    
         
             
              VALUE klass = define_error_class( "LockNotAvailable", "55" );
         
     | 
| 
       740 
828 
     | 
    
         
             
              register_error_class( "55P03", klass );
         
     | 
| 
       741 
829 
     | 
    
         
             
            }
         
     | 
| 
      
 830 
     | 
    
         
            +
            {
         
     | 
| 
      
 831 
     | 
    
         
            +
              VALUE klass = define_error_class( "UnsafeNewEnumValueUsage", "55" );
         
     | 
| 
      
 832 
     | 
    
         
            +
              register_error_class( "55P04", klass );
         
     | 
| 
      
 833 
     | 
    
         
            +
            }
         
     | 
| 
       742 
834 
     | 
    
         
             
            {
         
     | 
| 
       743 
835 
     | 
    
         
             
              VALUE klass = define_error_class( "OperatorIntervention", NULL );
         
     | 
| 
       744 
836 
     | 
    
         
             
              register_error_class( "57000", klass );
         
     | 
| 
         @@ -781,6 +873,11 @@ 
     | 
|
| 
       781 
873 
     | 
    
         
             
              VALUE klass = define_error_class( "DuplicateFile", "58" );
         
     | 
| 
       782 
874 
     | 
    
         
             
              register_error_class( "58P02", klass );
         
     | 
| 
       783 
875 
     | 
    
         
             
            }
         
     | 
| 
      
 876 
     | 
    
         
            +
            {
         
     | 
| 
      
 877 
     | 
    
         
            +
              VALUE klass = define_error_class( "SnapshotTooOld", NULL );
         
     | 
| 
      
 878 
     | 
    
         
            +
              register_error_class( "72000", klass );
         
     | 
| 
      
 879 
     | 
    
         
            +
              register_error_class( "72", klass );
         
     | 
| 
      
 880 
     | 
    
         
            +
            }
         
     | 
| 
       784 
881 
     | 
    
         
             
            {
         
     | 
| 
       785 
882 
     | 
    
         
             
              VALUE klass = define_error_class( "ConfigFileError", NULL );
         
     | 
| 
       786 
883 
     | 
    
         
             
              register_error_class( "F0000", klass );
         
     | 
| 
         @@ -916,6 +1013,10 @@ 
     | 
|
| 
       916 
1013 
     | 
    
         
             
              VALUE klass = define_error_class( "TooManyRows", "P0" );
         
     | 
| 
       917 
1014 
     | 
    
         
             
              register_error_class( "P0003", klass );
         
     | 
| 
       918 
1015 
     | 
    
         
             
            }
         
     | 
| 
      
 1016 
     | 
    
         
            +
            {
         
     | 
| 
      
 1017 
     | 
    
         
            +
              VALUE klass = define_error_class( "AssertFailure", "P0" );
         
     | 
| 
      
 1018 
     | 
    
         
            +
              register_error_class( "P0004", klass );
         
     | 
| 
      
 1019 
     | 
    
         
            +
            }
         
     | 
| 
       919 
1020 
     | 
    
         
             
            {
         
     | 
| 
       920 
1021 
     | 
    
         
             
              VALUE klass = define_error_class( "InternalError", NULL );
         
     | 
| 
       921 
1022 
     | 
    
         
             
              register_error_class( "XX000", klass );
         
     | 
    
        data/ext/errorcodes.rb
    CHANGED
    
    
    
        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
         
     | 
| 
         @@ -15,7 +15,10 @@ 
     | 
|
| 
       15 
15 
     | 
    
         
             
            #   src/pl/plpgsql/src/plerrcodes.h
         
     | 
| 
       16 
16 
     | 
    
         
             
            #      a list of PL/pgSQL condition names and their SQLSTATE codes
         
     | 
| 
       17 
17 
     | 
    
         
             
            #
         
     | 
| 
       18 
     | 
    
         
            -
            #    
     | 
| 
      
 18 
     | 
    
         
            +
            #   src/pl/tcl/pltclerrcodes.h
         
     | 
| 
      
 19 
     | 
    
         
            +
            #      the same, for PL/Tcl
         
     | 
| 
      
 20 
     | 
    
         
            +
            #
         
     | 
| 
      
 21 
     | 
    
         
            +
            #   doc/src/sgml/errcodes-table.sgml
         
     | 
| 
       19 
22 
     | 
    
         
             
            #      a SGML table of error codes for inclusion in the documentation
         
     | 
| 
       20 
23 
     | 
    
         
             
            #
         
     | 
| 
       21 
24 
     | 
    
         
             
            # The format of this file is one error code per line, with the following
         
     | 
| 
         @@ -174,15 +177,19 @@ Section: Class 22 - Data Exception 
     | 
|
| 
       174 
177 
     | 
    
         
             
            22P06    E    ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER                    nonstandard_use_of_escape_character
         
     | 
| 
       175 
178 
     | 
    
         
             
            22010    E    ERRCODE_INVALID_INDICATOR_PARAMETER_VALUE                      invalid_indicator_parameter_value
         
     | 
| 
       176 
179 
     | 
    
         
             
            22023    E    ERRCODE_INVALID_PARAMETER_VALUE                                invalid_parameter_value
         
     | 
| 
      
 180 
     | 
    
         
            +
            22013    E    ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE                    invalid_preceding_or_following_size
         
     | 
| 
       177 
181 
     | 
    
         
             
            2201B    E    ERRCODE_INVALID_REGULAR_EXPRESSION                             invalid_regular_expression
         
     | 
| 
       178 
182 
     | 
    
         
             
            2201W    E    ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE                      invalid_row_count_in_limit_clause
         
     | 
| 
       179 
183 
     | 
    
         
             
            2201X    E    ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE              invalid_row_count_in_result_offset_clause
         
     | 
| 
      
 184 
     | 
    
         
            +
            2202H    E    ERRCODE_INVALID_TABLESAMPLE_ARGUMENT                           invalid_tablesample_argument
         
     | 
| 
      
 185 
     | 
    
         
            +
            2202G    E    ERRCODE_INVALID_TABLESAMPLE_REPEAT                             invalid_tablesample_repeat
         
     | 
| 
       180 
186 
     | 
    
         
             
            22009    E    ERRCODE_INVALID_TIME_ZONE_DISPLACEMENT_VALUE                   invalid_time_zone_displacement_value
         
     | 
| 
       181 
187 
     | 
    
         
             
            2200C    E    ERRCODE_INVALID_USE_OF_ESCAPE_CHARACTER                        invalid_use_of_escape_character
         
     | 
| 
       182 
188 
     | 
    
         
             
            2200G    E    ERRCODE_MOST_SPECIFIC_TYPE_MISMATCH                            most_specific_type_mismatch
         
     | 
| 
       183 
189 
     | 
    
         
             
            22004    E    ERRCODE_NULL_VALUE_NOT_ALLOWED                                 null_value_not_allowed
         
     | 
| 
       184 
190 
     | 
    
         
             
            22002    E    ERRCODE_NULL_VALUE_NO_INDICATOR_PARAMETER                      null_value_no_indicator_parameter
         
     | 
| 
       185 
191 
     | 
    
         
             
            22003    E    ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE                             numeric_value_out_of_range
         
     | 
| 
      
 192 
     | 
    
         
            +
            2200H    E    ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED                      sequence_generator_limit_exceeded
         
     | 
| 
       186 
193 
     | 
    
         
             
            22026    E    ERRCODE_STRING_DATA_LENGTH_MISMATCH                            string_data_length_mismatch
         
     | 
| 
       187 
194 
     | 
    
         
             
            22001    E    ERRCODE_STRING_DATA_RIGHT_TRUNCATION                           string_data_right_truncation
         
     | 
| 
       188 
195 
     | 
    
         
             
            22011    E    ERRCODE_SUBSTRING_ERROR                                        substring_error
         
     | 
| 
         @@ -199,6 +206,21 @@ Section: Class 22 - Data Exception 
     | 
|
| 
       199 
206 
     | 
    
         
             
            2200N    E    ERRCODE_INVALID_XML_CONTENT                                    invalid_xml_content
         
     | 
| 
       200 
207 
     | 
    
         
             
            2200S    E    ERRCODE_INVALID_XML_COMMENT                                    invalid_xml_comment
         
     | 
| 
       201 
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
         
     | 
| 
       202 
224 
     | 
    
         | 
| 
       203 
225 
     | 
    
         
             
            Section: Class 23 - Integrity Constraint Violation
         
     | 
| 
       204 
226 
     | 
    
         | 
| 
         @@ -227,6 +249,7 @@ Section: Class 25 - Invalid Transaction State 
     | 
|
| 
       227 
249 
     | 
    
         
             
            25007    E    ERRCODE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED         schema_and_data_statement_mixing_not_supported
         
     | 
| 
       228 
250 
     | 
    
         
             
            25P01    E    ERRCODE_NO_ACTIVE_SQL_TRANSACTION                              no_active_sql_transaction
         
     | 
| 
       229 
251 
     | 
    
         
             
            25P02    E    ERRCODE_IN_FAILED_SQL_TRANSACTION                              in_failed_sql_transaction
         
     | 
| 
      
 252 
     | 
    
         
            +
            25P03    E    ERRCODE_IDLE_IN_TRANSACTION_SESSION_TIMEOUT                    idle_in_transaction_session_timeout
         
     | 
| 
       230 
253 
     | 
    
         | 
| 
       231 
254 
     | 
    
         
             
            Section: Class 26 - Invalid SQL Statement Name
         
     | 
| 
       232 
255 
     | 
    
         | 
| 
         @@ -278,6 +301,7 @@ Section: Class 39 - External Routine Invocation Exception 
     | 
|
| 
       278 
301 
     | 
    
         
             
            39004    E    ERRCODE_E_R_I_E_NULL_VALUE_NOT_ALLOWED                         null_value_not_allowed
         
     | 
| 
       279 
302 
     | 
    
         
             
            39P01    E    ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED                      trigger_protocol_violated
         
     | 
| 
       280 
303 
     | 
    
         
             
            39P02    E    ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED                          srf_protocol_violated
         
     | 
| 
      
 304 
     | 
    
         
            +
            39P03    E    ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED                event_trigger_protocol_violated
         
     | 
| 
       281 
305 
     | 
    
         | 
| 
       282 
306 
     | 
    
         
             
            Section: Class 3B - Savepoint Exception
         
     | 
| 
       283 
307 
     | 
    
         | 
| 
         @@ -319,6 +343,7 @@ Section: Class 42 - Syntax Error or Access Rule Violation 
     | 
|
| 
       319 
343 
     | 
    
         
             
            42P21    E    ERRCODE_COLLATION_MISMATCH                                     collation_mismatch
         
     | 
| 
       320 
344 
     | 
    
         
             
            42P22    E    ERRCODE_INDETERMINATE_COLLATION                                indeterminate_collation
         
     | 
| 
       321 
345 
     | 
    
         
             
            42809    E    ERRCODE_WRONG_OBJECT_TYPE                                      wrong_object_type
         
     | 
| 
      
 346 
     | 
    
         
            +
            428C9    E    ERRCODE_GENERATED_ALWAYS                                       generated_always
         
     | 
| 
       322 
347 
     | 
    
         | 
| 
       323 
348 
     | 
    
         
             
            # Note: for ERRCODE purposes, we divide namable objects into these categories:
         
     | 
| 
       324 
349 
     | 
    
         
             
            # databases, schemas, prepared statements, cursors, tables, columns,
         
     | 
| 
         @@ -391,6 +416,7 @@ Section: Class 55 - Object Not In Prerequisite State 
     | 
|
| 
       391 
416 
     | 
    
         
             
            55006    E    ERRCODE_OBJECT_IN_USE                                          object_in_use
         
     | 
| 
       392 
417 
     | 
    
         
             
            55P02    E    ERRCODE_CANT_CHANGE_RUNTIME_PARAM                              cant_change_runtime_param
         
     | 
| 
       393 
418 
     | 
    
         
             
            55P03    E    ERRCODE_LOCK_NOT_AVAILABLE                                     lock_not_available
         
     | 
| 
      
 419 
     | 
    
         
            +
            55P04    E    ERRCODE_UNSAFE_NEW_ENUM_VALUE_USAGE                            unsafe_new_enum_value_usage
         
     | 
| 
       394 
420 
     | 
    
         | 
| 
       395 
421 
     | 
    
         
             
            Section: Class 57 - Operator Intervention
         
     | 
| 
       396 
422 
     | 
    
         | 
| 
         @@ -410,6 +436,10 @@ Section: Class 58 - System Error (errors external to PostgreSQL itself) 
     | 
|
| 
       410 
436 
     | 
    
         
             
            58P01    E    ERRCODE_UNDEFINED_FILE                                         undefined_file
         
     | 
| 
       411 
437 
     | 
    
         
             
            58P02    E    ERRCODE_DUPLICATE_FILE                                         duplicate_file
         
     | 
| 
       412 
438 
     | 
    
         | 
| 
      
 439 
     | 
    
         
            +
            Section: Class 72 - Snapshot Failure
         
     | 
| 
      
 440 
     | 
    
         
            +
            # (class borrowed from Oracle)
         
     | 
| 
      
 441 
     | 
    
         
            +
            72000    E    ERRCODE_SNAPSHOT_TOO_OLD                                       snapshot_too_old
         
     | 
| 
      
 442 
     | 
    
         
            +
             
     | 
| 
       413 
443 
     | 
    
         
             
            Section: Class F0 - Configuration File Error
         
     | 
| 
       414 
444 
     | 
    
         | 
| 
       415 
445 
     | 
    
         
             
            # (PostgreSQL-specific error class)
         
     | 
| 
         @@ -454,6 +484,7 @@ P0000    E    ERRCODE_PLPGSQL_ERROR                                          plp 
     | 
|
| 
       454 
484 
     | 
    
         
             
            P0001    E    ERRCODE_RAISE_EXCEPTION                                        raise_exception
         
     | 
| 
       455 
485 
     | 
    
         
             
            P0002    E    ERRCODE_NO_DATA_FOUND                                          no_data_found
         
     | 
| 
       456 
486 
     | 
    
         
             
            P0003    E    ERRCODE_TOO_MANY_ROWS                                          too_many_rows
         
     | 
| 
      
 487 
     | 
    
         
            +
            P0004    E    ERRCODE_ASSERT_FAILURE                                         assert_failure
         
     | 
| 
       457 
488 
     | 
    
         | 
| 
       458 
489 
     | 
    
         
             
            Section: Class XX - Internal Error
         
     | 
| 
       459 
490 
     | 
    
         | 
    
        data/ext/extconf.rb
    CHANGED
    
    | 
         @@ -15,34 +15,40 @@ if pgdir = with_config( 'pg' ) 
     | 
|
| 
       15 
15 
     | 
    
         
             
            	ENV['PATH'] = "#{pgdir}/bin" + File::PATH_SEPARATOR + ENV['PATH']
         
     | 
| 
       16 
16 
     | 
    
         
             
            end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            if  
     | 
| 
       19 
     | 
    
         
            -
            	 
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
            	#  
     | 
| 
       22 
     | 
    
         
            -
            	 
     | 
| 
       23 
     | 
    
         
            -
            	have_library( 'gdi32', 'CreateDC' ) && append_library( $libs, 'gdi32' )
         
     | 
| 
       24 
     | 
    
         
            -
            	have_library( 'secur32' ) && append_library( $libs, 'secur32' )
         
     | 
| 
       25 
     | 
    
         
            -
            	have_library( 'ws2_32', 'WSASocket') && append_library( $libs, 'ws2_32' )
         
     | 
| 
       26 
     | 
    
         
            -
            	have_library( 'crypto', 'BIO_new' ) && append_library( $libs, 'crypto' )
         
     | 
| 
       27 
     | 
    
         
            -
            	have_library( 'ssl', 'SSL_new' ) && append_library( $libs, 'ssl' )
         
     | 
| 
       28 
     | 
    
         
            -
            end
         
     | 
| 
      
 18 
     | 
    
         
            +
            if enable_config("windows-cross")
         
     | 
| 
      
 19 
     | 
    
         
            +
            	# Avoid dependency to external libgcc.dll on x86-mingw32
         
     | 
| 
      
 20 
     | 
    
         
            +
            	$LDFLAGS << " -static-libgcc"
         
     | 
| 
      
 21 
     | 
    
         
            +
            	# Don't use pg_config for cross build, but --with-pg-* path options
         
     | 
| 
      
 22 
     | 
    
         
            +
            	dir_config 'pg'
         
     | 
| 
       29 
23 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
            if pgconfig = ( with_config('pg-config') || with_config('pg_config') || find_executable('pg_config') )
         
     | 
| 
       31 
     | 
    
         
            -
            	$stderr.puts "Using config values from %s" % [ pgconfig ]
         
     | 
| 
       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
         
     | 
| 
       42 
24 
     | 
    
         
             
            else
         
     | 
| 
       43 
     | 
    
         
            -
            	 
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
            	 
     | 
| 
      
 25 
     | 
    
         
            +
            	# Native build
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            	pgconfig = with_config('pg-config') ||
         
     | 
| 
      
 28 
     | 
    
         
            +
            		with_config('pg_config') ||
         
     | 
| 
      
 29 
     | 
    
         
            +
            		find_executable('pg_config')
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            	if pgconfig && pgconfig != 'ignore'
         
     | 
| 
      
 32 
     | 
    
         
            +
            		$stderr.puts "Using config values from %s" % [ pgconfig ]
         
     | 
| 
      
 33 
     | 
    
         
            +
            		incdir = `"#{pgconfig}" --includedir`.chomp
         
     | 
| 
      
 34 
     | 
    
         
            +
            		libdir = `"#{pgconfig}" --libdir`.chomp
         
     | 
| 
      
 35 
     | 
    
         
            +
            		dir_config 'pg', incdir, libdir
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            		# Try to use runtime path linker option, even if RbConfig doesn't know about it.
         
     | 
| 
      
 38 
     | 
    
         
            +
            		# The rpath option is usually set implicit by dir_config(), but so far not
         
     | 
| 
      
 39 
     | 
    
         
            +
            		# on MacOS-X.
         
     | 
| 
      
 40 
     | 
    
         
            +
            		if RbConfig::CONFIG["RPATHFLAG"].to_s.empty? && try_link('int main() {return 0;}', " -Wl,-rpath,#{libdir}")
         
     | 
| 
      
 41 
     | 
    
         
            +
            			$LDFLAGS << " -Wl,-rpath,#{libdir}"
         
     | 
| 
      
 42 
     | 
    
         
            +
            		end
         
     | 
| 
      
 43 
     | 
    
         
            +
            	else
         
     | 
| 
      
 44 
     | 
    
         
            +
            		$stderr.puts "No pg_config... trying anyway. If building fails, please try again with",
         
     | 
| 
      
 45 
     | 
    
         
            +
            			" --with-pg-config=/path/to/pg_config"
         
     | 
| 
      
 46 
     | 
    
         
            +
            		dir_config 'pg'
         
     | 
| 
      
 47 
     | 
    
         
            +
            	end
         
     | 
| 
      
 48 
     | 
    
         
            +
            end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            if RUBY_VERSION >= '2.3.0' && /solaris/ =~ RUBY_PLATFORM
         
     | 
| 
      
 51 
     | 
    
         
            +
            	append_cppflags( '-D__EXTENSIONS__' )
         
     | 
| 
       46 
52 
     | 
    
         
             
            end
         
     | 
| 
       47 
53 
     | 
    
         | 
| 
       48 
54 
     | 
    
         
             
            find_header( 'libpq-fe.h' ) or abort "Can't find the 'libpq-fe.h header"
         
     | 
| 
         @@ -54,43 +60,34 @@ abort "Can't find the PostgreSQL client library (libpq)" unless 
     | 
|
| 
       54 
60 
     | 
    
         
             
            	have_library( 'libpq', 'PQconnectdb', ['libpq-fe.h'] ) ||
         
     | 
| 
       55 
61 
     | 
    
         
             
            	have_library( 'ms/libpq', 'PQconnectdb', ['libpq-fe.h'] )
         
     | 
| 
       56 
62 
     | 
    
         | 
| 
      
 63 
     | 
    
         
            +
            if /mingw/ =~ RUBY_PLATFORM && RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
         
     | 
| 
      
 64 
     | 
    
         
            +
            	# Work around: https://sourceware.org/bugzilla/show_bug.cgi?id=22504
         
     | 
| 
      
 65 
     | 
    
         
            +
            	checking_for "workaround gcc version with link issue" do
         
     | 
| 
      
 66 
     | 
    
         
            +
            		`#{RbConfig::MAKEFILE_CONFIG['CC']} --version`.chomp =~ /\s(\d+)\.\d+\.\d+(\s|$)/ &&
         
     | 
| 
      
 67 
     | 
    
         
            +
            			$1.to_i >= 6 &&
         
     | 
| 
      
 68 
     | 
    
         
            +
            			have_library(':libpq.lib') # Prefer linking to libpq.lib over libpq.dll if available
         
     | 
| 
      
 69 
     | 
    
         
            +
            	end
         
     | 
| 
      
 70 
     | 
    
         
            +
            end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
       57 
72 
     | 
    
         
             
            # optional headers/functions
         
     | 
| 
       58 
     | 
    
         
            -
            have_func ' 
     | 
| 
      
 73 
     | 
    
         
            +
            have_func 'PQsetSingleRowMode' or
         
     | 
| 
       59 
74 
     | 
    
         
             
            	abort "Your PostgreSQL is too old. Either install an older version " +
         
     | 
| 
       60 
     | 
    
         
            -
            	      "of this gem or upgrade your database."
         
     | 
| 
       61 
     | 
    
         
            -
            have_func ' 
     | 
| 
       62 
     | 
    
         
            -
            have_func ' 
     | 
| 
       63 
     | 
    
         
            -
            have_func ' 
     | 
| 
       64 
     | 
    
         
            -
            have_func ' 
     | 
| 
       65 
     | 
    
         
            -
            have_func ' 
     | 
| 
       66 
     | 
    
         
            -
            have_func ' 
     | 
| 
       67 
     | 
    
         
            -
            have_func ' 
     | 
| 
       68 
     | 
    
         
            -
            have_func 'PQgetCancel'
         
     | 
| 
       69 
     | 
    
         
            -
            have_func 'lo_create'
         
     | 
| 
       70 
     | 
    
         
            -
            have_func 'pg_encoding_to_char'
         
     | 
| 
       71 
     | 
    
         
            -
            have_func 'pg_char_to_encoding'
         
     | 
| 
       72 
     | 
    
         
            -
            have_func 'PQsetClientEncoding'
         
     | 
| 
       73 
     | 
    
         
            -
            have_func 'PQlibVersion'
         
     | 
| 
       74 
     | 
    
         
            -
            have_func 'PQping'
         
     | 
| 
       75 
     | 
    
         
            -
            have_func 'PQsetSingleRowMode'
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
            have_func 'rb_encdb_alias'
         
     | 
| 
       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'
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
            $defs.push( "-DHAVE_ST_NOTIFY_EXTRA" ) if
         
     | 
| 
       89 
     | 
    
         
            -
            	have_struct_member 'struct pgNotify', 'extra', 'libpq-fe.h'
         
     | 
| 
      
 75 
     | 
    
         
            +
            	      "of this gem or upgrade your database to at least PostgreSQL-9.2."
         
     | 
| 
      
 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
         
     | 
| 
      
 81 
     | 
    
         
            +
            have_func 'timegm'
         
     | 
| 
      
 82 
     | 
    
         
            +
            have_func 'rb_gc_adjust_memory_usage' # since ruby-2.4
         
     | 
| 
       90 
83 
     | 
    
         | 
| 
       91 
84 
     | 
    
         
             
            # unistd.h confilicts with ruby/win32.h when cross compiling for win32 and ruby 1.9.1
         
     | 
| 
       92 
85 
     | 
    
         
             
            have_header 'unistd.h'
         
     | 
| 
       93 
     | 
    
         
            -
            have_header ' 
     | 
| 
      
 86 
     | 
    
         
            +
            have_header 'inttypes.h'
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            checking_for "C99 variable length arrays" do
         
     | 
| 
      
 89 
     | 
    
         
            +
            	$defs.push( "-DHAVE_VARIABLE_LENGTH_ARRAYS" ) if try_compile('void test_vla(int l){ int vla[l]; }')
         
     | 
| 
      
 90 
     | 
    
         
            +
            end
         
     | 
| 
       94 
91 
     | 
    
         | 
| 
       95 
92 
     | 
    
         
             
            create_header()
         
     | 
| 
       96 
93 
     | 
    
         
             
            create_makefile( "pg_ext" )
         
     | 
    
        data/ext/gvl_wrappers.c
    CHANGED
    
    | 
         @@ -5,6 +5,10 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            #include "pg.h"
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
      
 8 
     | 
    
         
            +
            #ifndef HAVE_PQENCRYPTPASSWORDCONN
         
     | 
| 
      
 9 
     | 
    
         
            +
            char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm){return NULL;}
         
     | 
| 
      
 10 
     | 
    
         
            +
            #endif
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
       8 
12 
     | 
    
         
             
            FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_WRAPPER_STRUCT );
         
     | 
| 
       9 
13 
     | 
    
         
             
            FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_SKELETON );
         
     | 
| 
       10 
14 
     | 
    
         
             
            FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB );
         
     | 
    
        data/ext/gvl_wrappers.h
    CHANGED
    
    | 
         @@ -15,14 +15,7 @@ 
     | 
|
| 
       15 
15 
     | 
    
         
             
            #ifndef __gvl_wrappers_h
         
     | 
| 
       16 
16 
     | 
    
         
             
            #define __gvl_wrappers_h
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            # 
     | 
| 
       19 
     | 
    
         
            -
            extern void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
         
     | 
| 
       20 
     | 
    
         
            -
            #endif
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
            #if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)
         
     | 
| 
       23 
     | 
    
         
            -
            extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
         
     | 
| 
       24 
     | 
    
         
            -
            				 rb_unblock_function_t *ubf, void *data2);
         
     | 
| 
       25 
     | 
    
         
            -
            #endif
         
     | 
| 
      
 18 
     | 
    
         
            +
            #include <ruby/thread.h>
         
     | 
| 
       26 
19 
     | 
    
         | 
| 
       27 
20 
     | 
    
         
             
            #define DEFINE_PARAM_LIST1(type, name) \
         
     | 
| 
       28 
21 
     | 
    
         
             
            	name,
         
     | 
| 
         @@ -53,21 +46,14 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1, 
     | 
|
| 
       53 
46 
     | 
    
         
             
            		return NULL; \
         
     | 
| 
       54 
47 
     | 
    
         
             
            	}
         
     | 
| 
       55 
48 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
            # 
     | 
| 
       57 
     | 
    
         
            -
            	 
     | 
| 
       58 
     | 
    
         
            -
            		 
     | 
| 
       59 
     | 
    
         
            -
            			 
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
            		}
         
     | 
| 
       65 
     | 
    
         
            -
            #else
         
     | 
| 
       66 
     | 
    
         
            -
            	#define DEFINE_GVL_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
         
     | 
| 
       67 
     | 
    
         
            -
            		rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
         
     | 
| 
       68 
     | 
    
         
            -
            			return name( FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname ); \
         
     | 
| 
       69 
     | 
    
         
            -
            		}
         
     | 
| 
       70 
     | 
    
         
            -
            #endif
         
     | 
| 
      
 49 
     | 
    
         
            +
            #define DEFINE_GVL_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
         
     | 
| 
      
 50 
     | 
    
         
            +
            	rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
         
     | 
| 
      
 51 
     | 
    
         
            +
            		struct gvl_wrapper_##name##_params params = { \
         
     | 
| 
      
 52 
     | 
    
         
            +
            			{FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname}, when_non_void((rettype)0) \
         
     | 
| 
      
 53 
     | 
    
         
            +
            		}; \
         
     | 
| 
      
 54 
     | 
    
         
            +
            		rb_thread_call_without_gvl(gvl_##name##_skeleton, ¶ms, RUBY_UBF_IO, 0); \
         
     | 
| 
      
 55 
     | 
    
         
            +
            		when_non_void( return params.retval; ) \
         
     | 
| 
      
 56 
     | 
    
         
            +
            	}
         
     | 
| 
       71 
57 
     | 
    
         | 
| 
       72 
58 
     | 
    
         
             
            #define DEFINE_GVL_STUB_DECL(name, when_non_void, rettype, lastparamtype, lastparamname) \
         
     | 
| 
       73 
59 
     | 
    
         
             
            	rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname);
         
     | 
| 
         @@ -80,21 +66,14 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1, 
     | 
|
| 
       80 
66 
     | 
    
         
             
            		return NULL; \
         
     | 
| 
       81 
67 
     | 
    
         
             
            	}
         
     | 
| 
       82 
68 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
            # 
     | 
| 
       84 
     | 
    
         
            -
            	 
     | 
| 
       85 
     | 
    
         
            -
            		 
     | 
| 
       86 
     | 
    
         
            -
            			 
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
            		}
         
     | 
| 
       92 
     | 
    
         
            -
            #else
         
     | 
| 
       93 
     | 
    
         
            -
            	#define DEFINE_GVLCB_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
         
     | 
| 
       94 
     | 
    
         
            -
            		rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
         
     | 
| 
       95 
     | 
    
         
            -
            			return name( FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname ); \
         
     | 
| 
       96 
     | 
    
         
            -
            		}
         
     | 
| 
       97 
     | 
    
         
            -
            #endif
         
     | 
| 
      
 69 
     | 
    
         
            +
            #define DEFINE_GVLCB_STUB(name, when_non_void, rettype, lastparamtype, lastparamname) \
         
     | 
| 
      
 70 
     | 
    
         
            +
            	rettype gvl_##name(FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST3) lastparamtype lastparamname){ \
         
     | 
| 
      
 71 
     | 
    
         
            +
            		struct gvl_wrapper_##name##_params params = { \
         
     | 
| 
      
 72 
     | 
    
         
            +
            			{FOR_EACH_PARAM_OF_##name(DEFINE_PARAM_LIST1) lastparamname}, when_non_void((rettype)0) \
         
     | 
| 
      
 73 
     | 
    
         
            +
            		}; \
         
     | 
| 
      
 74 
     | 
    
         
            +
            		rb_thread_call_with_gvl(gvl_##name##_skeleton, ¶ms); \
         
     | 
| 
      
 75 
     | 
    
         
            +
            		when_non_void( return params.retval; ) \
         
     | 
| 
      
 76 
     | 
    
         
            +
            	}
         
     | 
| 
       98 
77 
     | 
    
         | 
| 
       99 
78 
     | 
    
         
             
            #define GVL_TYPE_VOID(string)
         
     | 
| 
       100 
79 
     | 
    
         
             
            #define GVL_TYPE_NONVOID(string) string
         
     | 
| 
         @@ -195,8 +174,16 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1, 
     | 
|
| 
       195 
174 
     | 
    
         
             
            #define FOR_EACH_PARAM_OF_PQsendDescribePortal(param) \
         
     | 
| 
       196 
175 
     | 
    
         
             
            	param(PGconn *, conn)
         
     | 
| 
       197 
176 
     | 
    
         | 
| 
      
 177 
     | 
    
         
            +
            #define FOR_EACH_PARAM_OF_PQsetClientEncoding(param) \
         
     | 
| 
      
 178 
     | 
    
         
            +
            	param(PGconn *, conn)
         
     | 
| 
      
 179 
     | 
    
         
            +
             
     | 
| 
       198 
180 
     | 
    
         
             
            #define FOR_EACH_PARAM_OF_PQisBusy(param)
         
     | 
| 
       199 
181 
     | 
    
         | 
| 
      
 182 
     | 
    
         
            +
            #define FOR_EACH_PARAM_OF_PQencryptPasswordConn(param) \
         
     | 
| 
      
 183 
     | 
    
         
            +
            	param(PGconn *, conn) \
         
     | 
| 
      
 184 
     | 
    
         
            +
            	param(const char *, passwd) \
         
     | 
| 
      
 185 
     | 
    
         
            +
            	param(const char *, user)
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
       200 
187 
     | 
    
         
             
            #define FOR_EACH_PARAM_OF_PQcancel(param) \
         
     | 
| 
       201 
188 
     | 
    
         
             
            	param(PGcancel *, cancel) \
         
     | 
| 
       202 
189 
     | 
    
         
             
            	param(char *, errbuf)
         
     | 
| 
         @@ -226,10 +213,11 @@ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1, 
     | 
|
| 
       226 
213 
     | 
    
         
             
            	function(PQsendQueryPrepared, GVL_TYPE_NONVOID, int, int, resultFormat) \
         
     | 
| 
       227 
214 
     | 
    
         
             
            	function(PQsendDescribePrepared, GVL_TYPE_NONVOID, int, const char *, stmt) \
         
     | 
| 
       228 
215 
     | 
    
         
             
            	function(PQsendDescribePortal, GVL_TYPE_NONVOID, int, const char *, portal) \
         
     | 
| 
      
 216 
     | 
    
         
            +
            	function(PQsetClientEncoding, GVL_TYPE_NONVOID, int, const char *, encoding) \
         
     | 
| 
       229 
217 
     | 
    
         
             
            	function(PQisBusy, GVL_TYPE_NONVOID, int, PGconn *, conn) \
         
     | 
| 
      
 218 
     | 
    
         
            +
            	function(PQencryptPasswordConn, GVL_TYPE_NONVOID, char *, const char *, algorithm) \
         
     | 
| 
       230 
219 
     | 
    
         
             
            	function(PQcancel, GVL_TYPE_NONVOID, int, int, errbufsize);
         
     | 
| 
       231 
220 
     | 
    
         | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
       233 
221 
     | 
    
         
             
            FOR_EACH_BLOCKING_FUNCTION( DEFINE_GVL_STUB_DECL );
         
     | 
| 
       234 
222 
     | 
    
         | 
| 
       235 
223 
     | 
    
         |