pg 1.1.4-x64-mingw32 → 1.2.0-x64-mingw32
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 +63 -0
- data/Manifest.txt +3 -2
- data/README-Windows.rdoc +4 -4
- data/README.ja.rdoc +1 -2
- data/README.rdoc +43 -8
- data/Rakefile +3 -3
- data/Rakefile.cross +6 -3
- 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 +20 -18
- data/ext/pg_binary_decoder.c +9 -9
- data/ext/pg_binary_encoder.c +13 -12
- data/ext/pg_coder.c +5 -5
- data/ext/pg_connection.c +388 -298
- data/ext/pg_copy_coder.c +5 -3
- data/ext/pg_record_coder.c +490 -0
- data/ext/pg_result.c +269 -123
- 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 +4 -3
- 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/2.2/pg_ext.so +0 -0
- data/lib/2.3/pg_ext.so +0 -0
- data/lib/2.4/pg_ext.so +0 -0
- data/lib/2.5/pg_ext.so +0 -0
- data/lib/2.6/pg_ext.so +0 -0
- data/lib/libpq.dll +0 -0
- data/lib/pg.rb +2 -3
- data/lib/pg/basic_type_mapping.rb +79 -16
- 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 +10 -8
- data/spec/pg/basic_type_mapping_spec.rb +150 -13
- data/spec/pg/connection_spec.rb +89 -50
- data/spec/pg/result_spec.rb +193 -3
- data/spec/pg/tuple_spec.rb +55 -2
- data/spec/pg/type_map_by_column_spec.rb +5 -1
- data/spec/pg/type_spec.rb +180 -6
- metadata +27 -25
- metadata.gz.sig +2 -3
data/History.rdoc
CHANGED
@@ -1,3 +1,66 @@
|
|
1
|
+
== v1.2.0 [2019-12-20] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Repository:
|
4
|
+
- Our primary repository has been moved to Github https://github.com/ged/ruby-pg .
|
5
|
+
Most of the issues from https://bitbucket.org/ged/ruby-pg have been migrated. #43
|
6
|
+
|
7
|
+
API enhancements:
|
8
|
+
- Add PG::Result#field_name_type= and siblings to allow symbols to be used as field names. #306
|
9
|
+
- Add new methods for error reporting:
|
10
|
+
- PG::Connection#set_error_context_visibility
|
11
|
+
- PG::Result#verbose_error_message
|
12
|
+
- PG::Result#result_verbose_error_message (alias)
|
13
|
+
- Update errorcodes and error classes to PostgreSQL-12.0.
|
14
|
+
- New constants: PG_DIAG_SEVERITY_NONLOCALIZED, PQERRORS_SQLSTATE, PQSHOW_CONTEXT_NEVER, PQSHOW_CONTEXT_ERRORS, PQSHOW_CONTEXT_ALWAYS
|
15
|
+
|
16
|
+
Type cast enhancements:
|
17
|
+
- Add PG::TextEncoder::Record and PG::TextDecoder::Record for en/decoding of Composite Types. #258, #36
|
18
|
+
- Add PG::BasicTypeRegistry.register_coder to register instances instead of classes.
|
19
|
+
This is useful to register parametrized en/decoders like PG::TextDecoder::Record .
|
20
|
+
- Add PG::BasicTypeMapForQueries#encode_array_as= to switch between various interpretations of ruby arrays.
|
21
|
+
- Add Time, Array<Time>, Array<BigDecimal> and Array<IPAddr> encoders to PG::BasicTypeMapForQueries
|
22
|
+
- Exchange sprintf based float encoder by very fast own implementation with more natural format. #301
|
23
|
+
- Define encode and decode methods only in en/decoders that implement it, so that they can be queried by respond_to? .
|
24
|
+
- Improve PG::TypeMapByColumn#inspect
|
25
|
+
- Accept Integer and Float as input to TextEncoder::Numeric . #310
|
26
|
+
|
27
|
+
Other enhancements:
|
28
|
+
- Allocate the data part and the ruby object of PG::Result in one step, so that we don't need to check for valid data.
|
29
|
+
This removes PG::Result.allocate and PG::Result.new, which were callable but without any practical use. #42
|
30
|
+
- Make use of PQresultMemorySize() of PostgreSQL-12 and fall back to our internal estimator.
|
31
|
+
- Improve performance of PG::Result#stream_each_tuple .
|
32
|
+
- Store client encoding in data part of PG::Connection and PG::Result objects, so that we no longer use ruby's internal encoding bits. #280
|
33
|
+
- Update Windows fat binary gem to OpenSSL-1.1.1d and PostgreSQL-12.1.
|
34
|
+
- Add support for TruffleRuby. It is regulary tested as part of our CI.
|
35
|
+
- Enable +frozen_string_literal+ in all pg's ruby files
|
36
|
+
|
37
|
+
Bugfixes:
|
38
|
+
- Update the license in gemspec to "BSD-2-Clause".
|
39
|
+
It was incorrectly labeled "BSD-3-Clause". #40
|
40
|
+
- Respect PG::Coder#flags in PG::Coder#to_h.
|
41
|
+
- Fix PG::Result memsize reporting after #clear.
|
42
|
+
- Release field names to GC on PG::Result#clear.
|
43
|
+
- Fix double free in PG::Result#stream_each_tuple when an exception is raised in the block.
|
44
|
+
- Fix PG::Result#stream_each_tuple to deliver typemapped values.
|
45
|
+
- Fix encoding of Array<unknown> with PG::BasicTypeMapForQueries
|
46
|
+
|
47
|
+
Deprecated:
|
48
|
+
- Add a deprecation warning to PG::Connection#socket .
|
49
|
+
|
50
|
+
Removed:
|
51
|
+
- Remove PG::Connection#guess_result_memsize= which was temporary added in pg-1.1.
|
52
|
+
- Remove PG::Result.allocate and PG::Result.new (see enhancements).
|
53
|
+
- Remove support of tainted objects. #307
|
54
|
+
- Remove support of ruby-2.0 and 2.1. Minimum is ruby-2.2 now.
|
55
|
+
|
56
|
+
Documentation:
|
57
|
+
- Update description of connection params. See PG::Connection.new
|
58
|
+
- Link many method descriptions to corresponding libpq's documentation.
|
59
|
+
- Update sync_* and async_* query method descriptions and document the aliases.
|
60
|
+
The primary documentation is now at the async_* methods which are the default since pg-1.1.
|
61
|
+
- Fix documentation of many constants
|
62
|
+
|
63
|
+
|
1
64
|
== v1.1.4 [2019-01-08] Michael Granger <ged@FaerieMUD.org>
|
2
65
|
|
3
66
|
- Fix PG::BinaryDecoder::Timestamp on 32 bit systems. # 284
|
data/Manifest.txt
CHANGED
@@ -26,6 +26,7 @@ ext/pg_coder.c
|
|
26
26
|
ext/pg_connection.c
|
27
27
|
ext/pg_copy_coder.c
|
28
28
|
ext/pg_errors.c
|
29
|
+
ext/pg_record_coder.c
|
29
30
|
ext/pg_result.c
|
30
31
|
ext/pg_text_decoder.c
|
31
32
|
ext/pg_text_encoder.c
|
@@ -37,8 +38,8 @@ ext/pg_type_map_by_column.c
|
|
37
38
|
ext/pg_type_map_by_mri_type.c
|
38
39
|
ext/pg_type_map_by_oid.c
|
39
40
|
ext/pg_type_map_in_ruby.c
|
40
|
-
ext/
|
41
|
-
ext/
|
41
|
+
ext/pg_util.c
|
42
|
+
ext/pg_util.h
|
42
43
|
ext/vc/pg.sln
|
43
44
|
ext/vc/pg_18/pg.vcproj
|
44
45
|
ext/vc/pg_19/pg_19.vcproj
|
data/README-Windows.rdoc
CHANGED
@@ -35,8 +35,8 @@ Binary gems for windows can be built on Linux, OS-X and even on Windows
|
|
35
35
|
with the help of docker. This is how regular windows gems are built for
|
36
36
|
rubygems.org .
|
37
37
|
|
38
|
-
To do this, install boot2docker
|
39
|
-
or
|
38
|
+
To do this, install boot2docker {on Windows}[https://github.com/boot2docker/windows-installer/releases]
|
39
|
+
or {on OS X}[https://github.com/boot2docker/osx-installer/releases] and make
|
40
40
|
sure it is started. A native Docker installation is best on Linux.
|
41
41
|
|
42
42
|
Then run:
|
@@ -50,7 +50,7 @@ containing binaries for all supported ruby versions.
|
|
50
50
|
|
51
51
|
== Reporting Problems
|
52
52
|
|
53
|
-
If you have any problems you can submit them via
|
54
|
-
|
53
|
+
If you have any problems you can submit them via {the project's
|
54
|
+
issue-tracker}[https://github.com/ged/ruby-pg/issues]. And submit questions, problems, or
|
55
55
|
solutions, so that it can be improved.
|
56
56
|
|
data/README.ja.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
= pg
|
2
2
|
|
3
|
-
home :: https://
|
4
|
-
mirror :: https://github.com/ged/ruby-pg
|
3
|
+
home :: https://github.com/ged/ruby-pg
|
5
4
|
docs :: http://deveiate.org/code/pg
|
6
5
|
|
7
6
|
{<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Join the chat at https://gitter.im/ged/ruby-pg">}[https://gitter.im/ged/ruby-pg?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge]
|
@@ -32,7 +31,7 @@ A small example usage:
|
|
32
31
|
== Build Status
|
33
32
|
|
34
33
|
{<img src="https://travis-ci.org/ged/ruby-pg.svg?branch=master" alt="Build Status Travis-CI" />}[https://travis-ci.org/ged/ruby-pg]
|
35
|
-
{<img src="https://ci.appveyor.com/api/projects/status/
|
34
|
+
{<img src="https://ci.appveyor.com/api/projects/status/gjx5axouf3b1wicp?svg=true" alt="Build Status Appveyor" />}[https://ci.appveyor.com/project/ged/ruby-pg-9j8l3]
|
36
35
|
|
37
36
|
|
38
37
|
== Requirements
|
@@ -78,7 +77,7 @@ There's also {a Google+ group}[http://goo.gl/TFy1U] and a
|
|
78
77
|
want to chat about something.
|
79
78
|
|
80
79
|
If you want to install as a signed gem, the public certs of the gem signers
|
81
|
-
can be found in {the `certs` directory}[https://
|
80
|
+
can be found in {the `certs` directory}[https://github.com/ged/ruby-pg/tree/master/certs]
|
82
81
|
of the repository.
|
83
82
|
|
84
83
|
|
@@ -118,6 +117,30 @@ to build composite types by assigning an element encoder/decoder.
|
|
118
117
|
PG::Coder objects can be used to set up a PG::TypeMap or alternatively
|
119
118
|
to convert single values to/from their string representation.
|
120
119
|
|
120
|
+
The following PostgreSQL column types are supported by ruby-pg (TE = Text Encoder, TD = Text Decoder, BE = Binary Encoder, BD = Binary Decoder):
|
121
|
+
* Integer: {TE}[rdoc-ref:PG::TextEncoder::Integer], {TD}[rdoc-ref:PG::TextDecoder::Integer], {BD}[rdoc-ref:PG::BinaryDecoder::Integer]
|
122
|
+
* BE: {Int2}[rdoc-ref:PG::BinaryEncoder::Int2], {Int4}[rdoc-ref:PG::BinaryEncoder::Int4], {Int8}[rdoc-ref:PG::BinaryEncoder::Int8]
|
123
|
+
* Float: {TE}[rdoc-ref:PG::TextEncoder::Float], {TD}[rdoc-ref:PG::TextDecoder::Float], {BD}[rdoc-ref:PG::BinaryDecoder::Float]
|
124
|
+
* Numeric: {TE}[rdoc-ref:PG::TextEncoder::Numeric], {TD}[rdoc-ref:PG::TextDecoder::Numeric]
|
125
|
+
* Boolean: {TE}[rdoc-ref:PG::TextEncoder::Boolean], {TD}[rdoc-ref:PG::TextDecoder::Boolean], {BE}[rdoc-ref:PG::BinaryEncoder::Boolean], {BD}[rdoc-ref:PG::BinaryDecoder::Boolean]
|
126
|
+
* String: {TE}[rdoc-ref:PG::TextEncoder::String], {TD}[rdoc-ref:PG::TextDecoder::String], {BE}[rdoc-ref:PG::BinaryEncoder::String], {BD}[rdoc-ref:PG::BinaryDecoder::String]
|
127
|
+
* Bytea: {TE}[rdoc-ref:PG::TextEncoder::Bytea], {TD}[rdoc-ref:PG::TextDecoder::Bytea], {BE}[rdoc-ref:PG::BinaryEncoder::Bytea], {BD}[rdoc-ref:PG::BinaryDecoder::Bytea]
|
128
|
+
* Base64: {TE}[rdoc-ref:PG::TextEncoder::ToBase64], {TD}[rdoc-ref:PG::TextDecoder::FromBase64], {BE}[rdoc-ref:PG::BinaryEncoder::FromBase64], {BD}[rdoc-ref:PG::BinaryDecoder::ToBase64]
|
129
|
+
* Timestamp:
|
130
|
+
* TE: {local}[rdoc-ref:PG::TextEncoder::TimestampWithoutTimeZone], {UTC}[rdoc-ref:PG::TextEncoder::TimestampUtc], {with-TZ}[rdoc-ref:PG::TextEncoder::TimestampWithTimeZone]
|
131
|
+
* TD: {local}[rdoc-ref:PG::TextDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::TextDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::TextDecoder::TimestampUtcToLocal]
|
132
|
+
* BD: {local}[rdoc-ref:PG::BinaryDecoder::TimestampLocal], {UTC}[rdoc-ref:PG::BinaryDecoder::TimestampUtc], {UTC-to-local}[rdoc-ref:PG::BinaryDecoder::TimestampUtcToLocal]
|
133
|
+
* Date: {TE}[rdoc-ref:PG::TextEncoder::Date], {TD}[rdoc-ref:PG::TextDecoder::Date]
|
134
|
+
* JSON and JSONB: {TE}[rdoc-ref:PG::TextEncoder::JSON], {TD}[rdoc-ref:PG::TextDecoder::JSON]
|
135
|
+
* Inet: {TE}[rdoc-ref:PG::TextEncoder::Inet], {TD}[rdoc-ref:PG::TextDecoder::Inet]
|
136
|
+
* Array: {TE}[rdoc-ref:PG::TextEncoder::Array], {TD}[rdoc-ref:PG::TextDecoder::Array]
|
137
|
+
* Composite Type (also called "Row" or "Record"): {TE}[rdoc-ref:PG::TextEncoder::Record], {TD}[rdoc-ref:PG::TextDecoder::Record]
|
138
|
+
|
139
|
+
The following text formats can also be encoded although they are not used as column type:
|
140
|
+
* COPY input and output data: {TE}[rdoc-ref:PG::TextEncoder::CopyRow], {TD}[rdoc-ref:PG::TextDecoder::CopyRow]
|
141
|
+
* Literal for insertion into SQL string: {TE}[rdoc-ref:PG::TextEncoder::QuotedLiteral]
|
142
|
+
* SQL-Identifier: {TE}[rdoc-ref:PG::TextEncoder::Identifier], {TD}[rdoc-ref:PG::TextDecoder::Identifier]
|
143
|
+
|
121
144
|
=== PG::TypeMap and derivations (ext/pg_type_map*.c, lib/pg/type_map*.rb)
|
122
145
|
|
123
146
|
A TypeMap defines which value will be converted by which encoder/decoder.
|
@@ -129,11 +152,23 @@ A type map can be assigned per connection or per query respectively per
|
|
129
152
|
result set. Type maps can also be used for COPY in and out data streaming.
|
130
153
|
See PG::Connection#copy_data .
|
131
154
|
|
155
|
+
The following base type maps are available:
|
156
|
+
* PG::TypeMapAllStrings - encodes and decodes all values to and from strings (default)
|
157
|
+
* PG::TypeMapByClass - selects encoder based on the class of the value to be sent
|
158
|
+
* PG::TypeMapByColumn - selects encoder and decoder by column order
|
159
|
+
* PG::TypeMapByOid - selects decoder by PostgreSQL type OID
|
160
|
+
* PG::TypeMapInRuby - define a custom type map in ruby
|
161
|
+
|
162
|
+
The following type maps are prefilled with type mappings from the PG::BasicTypeRegistry :
|
163
|
+
* PG::BasicTypeMapForResults - a PG::TypeMapByOid prefilled with decoders for common PostgreSQL column types
|
164
|
+
* PG::BasicTypeMapBasedOnResult - a PG::TypeMapByOid prefilled with encoders for common PostgreSQL column types
|
165
|
+
* PG::BasicTypeMapForQueries - a PG::TypeMapByClass prefilled with encoders for common Ruby value classes
|
166
|
+
|
167
|
+
|
132
168
|
== Contributing
|
133
169
|
|
134
|
-
To report bugs, suggest features, or check out the source with
|
135
|
-
{check out the project page}[
|
136
|
-
Git, there's also a {Github mirror}[https://github.com/ged/ruby-pg].
|
170
|
+
To report bugs, suggest features, or check out the source with Git,
|
171
|
+
{check out the project page}[https://github.com/ged/ruby-pg].
|
137
172
|
|
138
173
|
After checking out the source, run:
|
139
174
|
|
@@ -148,7 +183,7 @@ Lars Kanis <lars@greiz-reinsdorf.de>.
|
|
148
183
|
|
149
184
|
== Copying
|
150
185
|
|
151
|
-
Copyright (c) 1997-
|
186
|
+
Copyright (c) 1997-2019 by the authors.
|
152
187
|
|
153
188
|
* Jeff Davis <ruby-pg@j-davis.com>
|
154
189
|
* Guy Decoux (ts) <decoux@moulon.inra.fr>
|
data/Rakefile
CHANGED
@@ -55,7 +55,7 @@ $hoespec = Hoe.spec 'pg' do
|
|
55
55
|
self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
|
56
56
|
self.extra_rdoc_files.include( 'POSTGRES', 'LICENSE' )
|
57
57
|
self.extra_rdoc_files.include( 'ext/*.c' )
|
58
|
-
self.license 'BSD-
|
58
|
+
self.license 'BSD-2-Clause'
|
59
59
|
|
60
60
|
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
61
61
|
self.developer 'Lars Kanis', 'lars@greiz-reinsdorf.de'
|
@@ -69,7 +69,7 @@ $hoespec = Hoe.spec 'pg' do
|
|
69
69
|
|
70
70
|
self.spec_extras[:extensions] = [ 'ext/extconf.rb' ]
|
71
71
|
|
72
|
-
self.require_ruby_version( '>= 2.
|
72
|
+
self.require_ruby_version( '>= 2.2' )
|
73
73
|
|
74
74
|
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
75
75
|
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
@@ -184,7 +184,7 @@ end
|
|
184
184
|
|
185
185
|
desc "Update list of server error codes"
|
186
186
|
task :update_error_codes do
|
187
|
-
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/
|
187
|
+
URL_ERRORCODES_TXT = "http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/utils/errcodes.txt;hb=refs/tags/REL_12_0"
|
188
188
|
|
189
189
|
ERRORCODES_TXT = "ext/errorcodes.txt"
|
190
190
|
sh "wget #{URL_ERRORCODES_TXT.inspect} -O #{ERRORCODES_TXT.inspect} || curl #{URL_ERRORCODES_TXT.inspect} -o #{ERRORCODES_TXT.inspect}"
|
data/Rakefile.cross
CHANGED
@@ -29,8 +29,8 @@ class CrossLibrary < OpenStruct
|
|
29
29
|
self.host_platform = toolchain
|
30
30
|
|
31
31
|
# Cross-compilation constants
|
32
|
-
self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.
|
33
|
-
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '
|
32
|
+
self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.1d'
|
33
|
+
self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '12.1'
|
34
34
|
|
35
35
|
# Check if symlinks work in the current working directory.
|
36
36
|
# This fails, if rake-compiler-dock is running on a Windows box.
|
@@ -217,6 +217,9 @@ class CrossLibrary < OpenStruct
|
|
217
217
|
chdir( static_postgresql_srcdir + "common" ) do
|
218
218
|
sh 'make', "-j#{NUM_CPUS}"
|
219
219
|
end
|
220
|
+
chdir( static_postgresql_srcdir + "port" ) do
|
221
|
+
sh 'make', "-j#{NUM_CPUS}"
|
222
|
+
end
|
220
223
|
|
221
224
|
chdir( postgresql_lib.dirname ) do
|
222
225
|
sh 'make',
|
@@ -292,7 +295,7 @@ task 'gem:windows' => ['ChangeLog'] do
|
|
292
295
|
RakeCompilerDock.sh <<-EOT
|
293
296
|
mkdir ~/.gem &&
|
294
297
|
(cp build/gem/gem-*.pem ~/.gem/ || true) &&
|
295
|
-
|
298
|
+
gem install -Ng &&
|
296
299
|
rake cross native gem MAKE="make -j`nproc`"
|
297
300
|
EOT
|
298
301
|
end
|
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
|
|