cipherstash-pg 1.0.0.beta.1-arm64-darwin-22 → 1.0.0.beta.3-arm64-darwin-22

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.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.appveyor.yml +42 -0
  3. data/.gems +6 -0
  4. data/.gemtest +0 -0
  5. data/.github/workflows/binary-gems.yml +117 -0
  6. data/.github/workflows/source-gem.yml +137 -0
  7. data/.gitignore +19 -0
  8. data/.hgsigs +34 -0
  9. data/.hgtags +41 -0
  10. data/.irbrc +23 -0
  11. data/.pryrc +23 -0
  12. data/.tm_properties +21 -0
  13. data/.travis.yml +49 -0
  14. data/Gemfile +3 -3
  15. data/Gemfile.lock +45 -0
  16. data/{History.rdoc → History.md} +168 -153
  17. data/README.ja.md +266 -0
  18. data/README.md +272 -0
  19. data/Rakefile +65 -104
  20. data/Rakefile.cross +298 -0
  21. data/certs/larskanis-2023.pem +24 -0
  22. data/cipherstash-pg.gemspec +0 -0
  23. data/lib/2.7/pg_ext.bundle +0 -0
  24. data/lib/3.0/pg_ext.bundle +0 -0
  25. data/lib/3.1/pg_ext.bundle +0 -0
  26. data/lib/3.2/pg_ext.bundle +0 -0
  27. data/lib/cipherstash-pg/basic_type_map_based_on_result.rb +11 -0
  28. data/lib/cipherstash-pg/basic_type_map_for_queries.rb +113 -0
  29. data/lib/cipherstash-pg/basic_type_map_for_results.rb +30 -0
  30. data/lib/cipherstash-pg/basic_type_registry.rb +206 -0
  31. data/lib/cipherstash-pg/binary_decoder.rb +21 -0
  32. data/lib/cipherstash-pg/coder.rb +82 -0
  33. data/lib/cipherstash-pg/connection.rb +467 -0
  34. data/lib/cipherstash-pg/constants.rb +3 -0
  35. data/lib/cipherstash-pg/exceptions.rb +19 -0
  36. data/lib/cipherstash-pg/result.rb +22 -0
  37. data/lib/cipherstash-pg/text_decoder.rb +43 -0
  38. data/lib/cipherstash-pg/text_encoder.rb +67 -0
  39. data/lib/cipherstash-pg/tuple.rb +24 -0
  40. data/lib/cipherstash-pg/type_map_by_column.rb +11 -0
  41. data/lib/cipherstash-pg/version.rb +3 -0
  42. data/lib/cipherstash-pg.rb +56 -11
  43. data/lib/libpq.5.dylib +0 -0
  44. data/misc/openssl-pg-segfault.rb +15 -25
  45. data/misc/postgres/Rakefile +13 -20
  46. data/misc/postgres/lib/postgres.rb +10 -14
  47. data/misc/ruby-pg/Rakefile +13 -20
  48. data/misc/ruby-pg/lib/ruby/pg.rb +10 -14
  49. data/rakelib/task_extension.rb +17 -31
  50. data/sample/array_insert.rb +7 -20
  51. data/sample/async_api.rb +54 -96
  52. data/sample/async_copyto.rb +20 -35
  53. data/sample/async_mixed.rb +22 -50
  54. data/sample/check_conn.rb +8 -20
  55. data/sample/copydata.rb +18 -68
  56. data/sample/copyfrom.rb +26 -78
  57. data/sample/copyto.rb +10 -16
  58. data/sample/cursor.rb +9 -19
  59. data/sample/disk_usage_report.rb +89 -174
  60. data/sample/issue-119.rb +45 -93
  61. data/sample/losample.rb +48 -66
  62. data/sample/minimal-testcase.rb +6 -17
  63. data/sample/notify_wait.rb +21 -67
  64. data/sample/pg_statistics.rb +100 -281
  65. data/sample/replication_monitor.rb +119 -218
  66. data/sample/test_binary_values.rb +14 -30
  67. data/sample/wal_shipper.rb +199 -431
  68. data/sample/warehouse_partitions.rb +157 -307
  69. data/translation/.po4a-version +7 -0
  70. data/translation/po/all.pot +875 -0
  71. data/translation/po/ja.po +868 -0
  72. data/translation/po4a.cfg +9 -0
  73. metadata +50 -30
  74. data/README.ja.rdoc +0 -13
  75. data/README.rdoc +0 -233
  76. data/lib/pg/basic_type_map_based_on_result.rb +0 -47
  77. data/lib/pg/basic_type_map_for_queries.rb +0 -193
  78. data/lib/pg/basic_type_map_for_results.rb +0 -81
  79. data/lib/pg/basic_type_registry.rb +0 -301
  80. data/lib/pg/binary_decoder.rb +0 -23
  81. data/lib/pg/coder.rb +0 -104
  82. data/lib/pg/connection.rb +0 -878
  83. data/lib/pg/constants.rb +0 -12
  84. data/lib/pg/exceptions.rb +0 -18
  85. data/lib/pg/result.rb +0 -43
  86. data/lib/pg/text_decoder.rb +0 -46
  87. data/lib/pg/text_encoder.rb +0 -59
  88. data/lib/pg/tuple.rb +0 -30
  89. data/lib/pg/type_map_by_column.rb +0 -16
  90. data/lib/pg/version.rb +0 -4
  91. data/lib/pg.rb +0 -55
  92. data/vendor/database-extensions/install.sql +0 -317
  93. data/vendor/database-extensions/uninstall.sql +0 -20
data/lib/pg/constants.rb DELETED
@@ -1,12 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
-
7
- module PG::Constants
8
-
9
- # Most of these are defined in the extension.
10
-
11
- end # module PG::Constants
12
-
data/lib/pg/exceptions.rb DELETED
@@ -1,18 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
-
7
- module PG
8
-
9
- class Error < StandardError
10
- def initialize(msg=nil, connection: nil, result: nil)
11
- @connection = connection
12
- @result = result
13
- super(msg)
14
- end
15
- end
16
-
17
- end # module PG
18
-
data/lib/pg/result.rb DELETED
@@ -1,43 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
-
7
- class PG::Result
8
-
9
- # Apply a type map for all value retrieving methods.
10
- #
11
- # +type_map+: a PG::TypeMap instance.
12
- #
13
- # This method is equal to #type_map= , but returns self, so that calls can be chained.
14
- #
15
- # See also PG::BasicTypeMapForResults
16
- def map_types!(type_map)
17
- self.type_map = type_map
18
- return self
19
- end
20
-
21
- # Set the data type for all field name returning methods.
22
- #
23
- # +type+: a Symbol defining the field name type.
24
- #
25
- # This method is equal to #field_name_type= , but returns self, so that calls can be chained.
26
- def field_names_as(type)
27
- self.field_name_type = type
28
- return self
29
- end
30
-
31
- ### Return a String representation of the object suitable for debugging.
32
- def inspect
33
- str = self.to_s
34
- str[-1,0] = if cleared?
35
- " cleared"
36
- else
37
- " status=#{res_status(result_status)} ntuples=#{ntuples} nfields=#{nfields} cmd_tuples=#{cmd_tuples}"
38
- end
39
- return str
40
- end
41
-
42
- end # class PG::Result
43
-
@@ -1,46 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'date'
5
- require 'json'
6
-
7
- module PG
8
- module TextDecoder
9
- class Date < SimpleDecoder
10
- def decode(string, tuple=nil, field=nil)
11
- if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
12
- ::Date.new $1.to_i, $2.to_i, $3.to_i
13
- else
14
- string
15
- end
16
- end
17
- end
18
-
19
- class JSON < SimpleDecoder
20
- def decode(string, tuple=nil, field=nil)
21
- ::JSON.parse(string, quirks_mode: true)
22
- end
23
- end
24
-
25
- # Convenience classes for timezone options
26
- class TimestampUtc < Timestamp
27
- def initialize(params={})
28
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_UTC))
29
- end
30
- end
31
- class TimestampUtcToLocal < Timestamp
32
- def initialize(params={})
33
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL))
34
- end
35
- end
36
- class TimestampLocal < Timestamp
37
- def initialize(params={})
38
- super(params.merge(flags: PG::Coder::TIMESTAMP_DB_LOCAL | PG::Coder::TIMESTAMP_APP_LOCAL))
39
- end
40
- end
41
-
42
- # For backward compatibility:
43
- TimestampWithoutTimeZone = TimestampLocal
44
- TimestampWithTimeZone = Timestamp
45
- end
46
- end # module PG
@@ -1,59 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'json'
5
- require 'ipaddr'
6
-
7
- module PG
8
- module TextEncoder
9
- class Date < SimpleEncoder
10
- def encode(value)
11
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value
12
- end
13
- end
14
-
15
- class TimestampWithoutTimeZone < SimpleEncoder
16
- def encode(value)
17
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N") : value
18
- end
19
- end
20
-
21
- class TimestampUtc < SimpleEncoder
22
- def encode(value)
23
- value.respond_to?(:utc) ? value.utc.strftime("%Y-%m-%d %H:%M:%S.%N") : value
24
- end
25
- end
26
-
27
- class TimestampWithTimeZone < SimpleEncoder
28
- def encode(value)
29
- value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d %H:%M:%S.%N %:z") : value
30
- end
31
- end
32
-
33
- class JSON < SimpleEncoder
34
- def encode(value)
35
- ::JSON.generate(value, quirks_mode: true)
36
- end
37
- end
38
-
39
- class Inet < SimpleEncoder
40
- def encode(value)
41
- case value
42
- when IPAddr
43
- default_prefix = (value.family == Socket::AF_INET ? 32 : 128)
44
- s = value.to_s
45
- if value.respond_to?(:prefix)
46
- prefix = value.prefix
47
- else
48
- range = value.to_range
49
- prefix = default_prefix - Math.log(((range.end.to_i - range.begin.to_i) + 1), 2).to_i
50
- end
51
- s << "/" << prefix.to_s if prefix != default_prefix
52
- s
53
- else
54
- value
55
- end
56
- end
57
- end
58
- end
59
- end # module PG
data/lib/pg/tuple.rb DELETED
@@ -1,30 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
-
7
- class PG::Tuple
8
-
9
- ### Return a String representation of the object suitable for debugging.
10
- def inspect
11
- "#<#{self.class} #{self.map{|k,v| "#{k}: #{v.inspect}" }.join(", ") }>"
12
- end
13
-
14
- def has_key?(key)
15
- field_map.has_key?(key)
16
- end
17
- alias key? has_key?
18
-
19
- def keys
20
- field_names || field_map.keys.freeze
21
- end
22
-
23
- def each_key(&block)
24
- if fn=field_names
25
- fn.each(&block)
26
- else
27
- field_map.each_key(&block)
28
- end
29
- end
30
- end
@@ -1,16 +0,0 @@
1
- # -*- ruby -*-
2
- # frozen_string_literal: true
3
-
4
- require 'pg' unless defined?( PG )
5
-
6
- class PG::TypeMapByColumn
7
- # Returns the type oids of the assigned coders.
8
- def oids
9
- coders.map{|c| c.oid if c }
10
- end
11
-
12
- def inspect
13
- type_strings = coders.map{|c| c ? c.inspect_short : 'nil' }
14
- "#<#{self.class} #{type_strings.join(' ')}>"
15
- end
16
- end
data/lib/pg/version.rb DELETED
@@ -1,4 +0,0 @@
1
- module PG
2
- # Library version
3
- VERSION = '1.4.5'
4
- end
data/lib/pg.rb DELETED
@@ -1,55 +0,0 @@
1
-
2
- # -*- ruby -*-
3
- # frozen_string_literal: true
4
-
5
- # The top-level PG namespace.
6
- module PG
7
-
8
- # cipherstash-pg *always* ships a "fat" gem with precompiled libs for each popular major.minor version
9
- # of Ruby that is still in use.
10
- major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or
11
- raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}"
12
- begin
13
- require "#{major_minor}/pg_ext"
14
- rescue => e
15
- STDERR.puts "Failed to load pg_ext for #{RUBY_VERSION.dump}"
16
- exit 1
17
- end
18
-
19
- class NotAllCopyDataRetrieved < PG::Error
20
- end
21
- class NotInBlockingMode < PG::Error
22
- end
23
-
24
- # Get the PG library version.
25
- #
26
- # +include_buildnum+ is no longer used and any value passed will be ignored.
27
- def self.version_string( include_buildnum=nil )
28
- "%s %s" % [ self.name, VERSION ]
29
- end
30
-
31
-
32
- ### Convenience alias for PG::Connection.new.
33
- def self.connect( *args, &block )
34
- Connection.new( *args, &block )
35
- end
36
-
37
-
38
- require 'pg/exceptions'
39
- require 'pg/constants'
40
- require 'pg/coder'
41
- require 'pg/binary_decoder'
42
- require 'pg/text_encoder'
43
- require 'pg/text_decoder'
44
- require 'pg/basic_type_registry'
45
- require 'pg/basic_type_map_based_on_result'
46
- require 'pg/basic_type_map_for_queries'
47
- require 'pg/basic_type_map_for_results'
48
- require 'pg/type_map_by_column'
49
- require 'pg/connection'
50
- require 'pg/result'
51
- require 'pg/tuple'
52
- require 'pg/version'
53
-
54
- end # module PG
55
-
@@ -1,317 +0,0 @@
1
- CREATE EXTENSION IF NOT EXISTS pgcrypto;
2
-
3
- CREATE TYPE ore_64_8_v1_term AS (
4
- bytes bytea
5
- );
6
-
7
- CREATE TYPE ore_64_8_v1 AS (
8
- terms ore_64_8_v1_term[]
9
- );
10
-
11
- CREATE OR REPLACE FUNCTION compare_ore_64_8_v1_term(a ore_64_8_v1_term, b ore_64_8_v1_term) returns integer AS $$
12
- DECLARE
13
- eq boolean := true;
14
- unequal_block smallint := 0;
15
- hash_key bytea;
16
- target_block bytea;
17
-
18
- left_block_size CONSTANT smallint := 16;
19
- right_block_size CONSTANT smallint := 32;
20
- right_offset CONSTANT smallint := 136; -- 8 * 17
21
-
22
- indicator smallint := 0;
23
- BEGIN
24
- IF a IS NULL AND b IS NULL THEN
25
- RETURN 0;
26
- END IF;
27
-
28
- IF a IS NULL THEN
29
- RETURN -1;
30
- END IF;
31
-
32
- IF b IS NULL THEN
33
- RETURN 1;
34
- END IF;
35
-
36
- IF bit_length(a.bytes) != bit_length(b.bytes) THEN
37
- RAISE EXCEPTION 'Ciphertexts are different lengths';
38
- END IF;
39
-
40
- FOR block IN 0..7 LOOP
41
- -- Compare each PRP (byte from the first 8 bytes) and PRF block (8 byte
42
- -- chunks of the rest of the value).
43
- -- NOTE:
44
- -- * Substr is ordinally indexed (hence 1 and not 0, and 9 and not 8).
45
- -- * We are not worrying about timing attacks here; don't fret about
46
- -- the OR or !=.
47
- IF
48
- substr(a.bytes, 1 + block, 1) != substr(b.bytes, 1 + block, 1)
49
- OR substr(a.bytes, 9 + left_block_size * block, left_block_size) != substr(b.bytes, 9 + left_block_size * BLOCK, left_block_size)
50
- THEN
51
- -- set the first unequal block we find
52
- IF eq THEN
53
- unequal_block := block;
54
- END IF;
55
- eq = false;
56
- END IF;
57
- END LOOP;
58
-
59
- IF eq THEN
60
- RETURN 0::integer;
61
- END IF;
62
-
63
- -- Hash key is the IV from the right CT of b
64
- hash_key := substr(b.bytes, right_offset + 1, 16);
65
-
66
- -- first right block is at right offset + nonce_size (ordinally indexed)
67
- target_block := substr(b.bytes, right_offset + 17 + (unequal_block * right_block_size), right_block_size);
68
-
69
- indicator := (
70
- get_bit(
71
- encrypt(
72
- substr(a.bytes, 9 + (left_block_size * unequal_block), left_block_size),
73
- hash_key,
74
- 'aes-ecb'
75
- ),
76
- 0
77
- ) + get_bit(target_block, get_byte(a.bytes, unequal_block))) % 2;
78
-
79
- IF indicator = 1 THEN
80
- RETURN 1::integer;
81
- ELSE
82
- RETURN -1::integer;
83
- END IF;
84
- END;
85
- $$ LANGUAGE plpgsql;
86
-
87
-
88
- CREATE OR REPLACE FUNCTION ore_64_8_v1_term_eq(a ore_64_8_v1_term, b ore_64_8_v1_term) RETURNS boolean AS $$
89
- SELECT compare_ore_64_8_v1_term(a, b) = 0
90
- $$ LANGUAGE SQL;
91
-
92
- CREATE OR REPLACE FUNCTION ore_64_8_v1_term_neq(a ore_64_8_v1_term, b ore_64_8_v1_term) RETURNS boolean AS $$
93
- SELECT compare_ore_64_8_v1_term(a, b) <> 0
94
- $$ LANGUAGE SQL;
95
-
96
- CREATE OR REPLACE FUNCTION ore_64_8_v1_term_lt(a ore_64_8_v1_term, b ore_64_8_v1_term) RETURNS boolean AS $$
97
- SELECT compare_ore_64_8_v1_term(a, b) = -1
98
- $$ LANGUAGE SQL;
99
-
100
- CREATE OR REPLACE FUNCTION ore_64_8_v1_term_lte(a ore_64_8_v1_term, b ore_64_8_v1_term) RETURNS boolean AS $$
101
- SELECT compare_ore_64_8_v1_term(a, b) != 1
102
- $$ LANGUAGE SQL;
103
-
104
- CREATE OR REPLACE FUNCTION ore_64_8_v1_term_gt(a ore_64_8_v1_term, b ore_64_8_v1_term) RETURNS boolean AS $$
105
- SELECT compare_ore_64_8_v1_term(a, b) = 1
106
- $$ LANGUAGE SQL;
107
-
108
- CREATE OR REPLACE FUNCTION ore_64_8_v1_term_gte(a ore_64_8_v1_term, b ore_64_8_v1_term) RETURNS boolean AS $$
109
- SELECT compare_ore_64_8_v1_term(a, b) != -1
110
- $$ LANGUAGE SQL;
111
-
112
- CREATE OPERATOR = (
113
- PROCEDURE="ore_64_8_v1_term_eq",
114
- LEFTARG=ore_64_8_v1_term,
115
- RIGHTARG=ore_64_8_v1_term,
116
- NEGATOR = <>,
117
- RESTRICT = eqsel,
118
- JOIN = eqjoinsel,
119
- HASHES,
120
- MERGES
121
- );
122
-
123
- CREATE OPERATOR <> (
124
- PROCEDURE="ore_64_8_v1_term_neq",
125
- LEFTARG=ore_64_8_v1_term,
126
- RIGHTARG=ore_64_8_v1_term,
127
- NEGATOR = =,
128
- RESTRICT = eqsel,
129
- JOIN = eqjoinsel,
130
- HASHES,
131
- MERGES
132
- );
133
-
134
- CREATE OPERATOR > (
135
- PROCEDURE="ore_64_8_v1_term_gt",
136
- LEFTARG=ore_64_8_v1_term,
137
- RIGHTARG=ore_64_8_v1_term,
138
- COMMUTATOR = <,
139
- NEGATOR = <=,
140
- RESTRICT = scalargtsel,
141
- JOIN = scalargtjoinsel
142
- );
143
-
144
- CREATE OPERATOR < (
145
- PROCEDURE="ore_64_8_v1_term_lt",
146
- LEFTARG=ore_64_8_v1_term,
147
- RIGHTARG=ore_64_8_v1_term,
148
- COMMUTATOR = >,
149
- NEGATOR = >=,
150
- RESTRICT = scalarltsel,
151
- JOIN = scalarltjoinsel
152
- );
153
-
154
- CREATE OPERATOR <= (
155
- PROCEDURE="ore_64_8_v1_term_lte",
156
- LEFTARG=ore_64_8_v1_term,
157
- RIGHTARG=ore_64_8_v1_term,
158
- COMMUTATOR = >=,
159
- NEGATOR = >,
160
- RESTRICT = scalarlesel,
161
- JOIN = scalarlejoinsel
162
- );
163
-
164
- CREATE OPERATOR >= (
165
- PROCEDURE="ore_64_8_v1_term_gte",
166
- LEFTARG=ore_64_8_v1_term,
167
- RIGHTARG=ore_64_8_v1_term,
168
- COMMUTATOR = <=,
169
- NEGATOR = <,
170
- RESTRICT = scalarlesel,
171
- JOIN = scalarlejoinsel
172
- );
173
-
174
- CREATE OPERATOR FAMILY ore_64_8_v1_term_btree_ops USING btree;
175
- CREATE OPERATOR CLASS ore_64_8_v1_term_btree_ops DEFAULT FOR TYPE ore_64_8_v1_term USING btree FAMILY ore_64_8_v1_term_btree_ops AS
176
- OPERATOR 1 <,
177
- OPERATOR 2 <=,
178
- OPERATOR 3 =,
179
- OPERATOR 4 >=,
180
- OPERATOR 5 >,
181
- FUNCTION 1 compare_ore_64_8_v1_term(a ore_64_8_v1_term, b ore_64_8_v1_term);
182
-
183
- -- Compare the "head" of each array and recurse if necessary
184
- -- This function assumes an empty string is "less than" everything else
185
- -- so if a is empty we return -1, if be is empty and a isn't, we return 1.
186
- -- If both are empty we return 0. This cases probably isn't necessary as equality
187
- -- doesn't always make sense but it's here for completeness.
188
- -- If both are non-empty, we compare the first element. If they are equal
189
- -- we need to consider the next block so we recurse, otherwise we return the comparison result.
190
- CREATE OR REPLACE FUNCTION compare_ore_array(a ore_64_8_v1_term[], b ore_64_8_v1_term[]) returns integer AS $$
191
- DECLARE
192
- cmp_result integer;
193
- BEGIN
194
- IF (array_length(a, 1) = 0 OR a IS NULL) AND (array_length(b, 1) = 0 OR b IS NULL) THEN
195
- RETURN 0;
196
- END IF;
197
- IF array_length(a, 1) = 0 OR a IS NULL THEN
198
- RETURN -1;
199
- END IF;
200
- IF array_length(b, 1) = 0 OR a IS NULL THEN
201
- RETURN 1;
202
- END IF;
203
-
204
- cmp_result := compare_ore_64_8_v1_term(a[1], b[1]);
205
- IF cmp_result = 0 THEN
206
- -- Removes the first element in the array, and calls this fn again to compare the next element/s in the array.
207
- RETURN compare_ore_array(a[2:array_length(a,1)], b[2:array_length(b,1)]);
208
- END IF;
209
-
210
- RETURN cmp_result;
211
- END
212
- $$ LANGUAGE plpgsql;
213
-
214
- -- This function uses lexicographic comparison
215
- CREATE OR REPLACE FUNCTION compare_ore_64_8_v1(a ore_64_8_v1, b ore_64_8_v1) returns integer AS $$
216
- DECLARE
217
- cmp_result integer;
218
- BEGIN
219
- -- Recursively compare blocks bailing as soon as we can make a decision
220
- RETURN compare_ore_array(a.terms, b.terms);
221
- END
222
- $$ LANGUAGE plpgsql;
223
-
224
- CREATE OR REPLACE FUNCTION ore_64_8_v1_eq(a ore_64_8_v1, b ore_64_8_v1) RETURNS boolean AS $$
225
- SELECT compare_ore_64_8_v1(a, b) = 0
226
- $$ LANGUAGE SQL;
227
-
228
- CREATE OR REPLACE FUNCTION ore_64_8_v1_neq(a ore_64_8_v1, b ore_64_8_v1) RETURNS boolean AS $$
229
- SELECT compare_ore_64_8_v1(a, b) <> 0
230
- $$ LANGUAGE SQL;
231
-
232
- CREATE OR REPLACE FUNCTION ore_64_8_v1_lt(a ore_64_8_v1, b ore_64_8_v1) RETURNS boolean AS $$
233
- SELECT compare_ore_64_8_v1(a, b) = -1
234
- $$ LANGUAGE SQL;
235
-
236
- CREATE OR REPLACE FUNCTION ore_64_8_v1_lte(a ore_64_8_v1, b ore_64_8_v1) RETURNS boolean AS $$
237
- SELECT compare_ore_64_8_v1(a, b) != 1
238
- $$ LANGUAGE SQL;
239
-
240
- CREATE OR REPLACE FUNCTION ore_64_8_v1_gt(a ore_64_8_v1, b ore_64_8_v1) RETURNS boolean AS $$
241
- SELECT compare_ore_64_8_v1(a, b) = 1
242
- $$ LANGUAGE SQL;
243
-
244
- CREATE OR REPLACE FUNCTION ore_64_8_v1_gte(a ore_64_8_v1, b ore_64_8_v1) RETURNS boolean AS $$
245
- SELECT compare_ore_64_8_v1(a, b) != -1
246
- $$ LANGUAGE SQL;
247
-
248
- CREATE OPERATOR = (
249
- PROCEDURE="ore_64_8_v1_eq",
250
- LEFTARG=ore_64_8_v1,
251
- RIGHTARG=ore_64_8_v1,
252
- NEGATOR = <>,
253
- RESTRICT = eqsel,
254
- JOIN = eqjoinsel,
255
- HASHES,
256
- MERGES
257
- );
258
-
259
- CREATE OPERATOR <> (
260
- PROCEDURE="ore_64_8_v1_neq",
261
- LEFTARG=ore_64_8_v1,
262
- RIGHTARG=ore_64_8_v1,
263
- NEGATOR = =,
264
- RESTRICT = eqsel,
265
- JOIN = eqjoinsel,
266
- HASHES,
267
- MERGES
268
- );
269
-
270
- CREATE OPERATOR > (
271
- PROCEDURE="ore_64_8_v1_gt",
272
- LEFTARG=ore_64_8_v1,
273
- RIGHTARG=ore_64_8_v1,
274
- COMMUTATOR = <,
275
- NEGATOR = <=,
276
- RESTRICT = scalargtsel,
277
- JOIN = scalargtjoinsel
278
- );
279
-
280
- CREATE OPERATOR < (
281
- PROCEDURE="ore_64_8_v1_lt",
282
- LEFTARG=ore_64_8_v1,
283
- RIGHTARG=ore_64_8_v1,
284
- COMMUTATOR = >,
285
- NEGATOR = >=,
286
- RESTRICT = scalarltsel,
287
- JOIN = scalarltjoinsel
288
- );
289
-
290
- CREATE OPERATOR <= (
291
- PROCEDURE="ore_64_8_v1_lte",
292
- LEFTARG=ore_64_8_v1,
293
- RIGHTARG=ore_64_8_v1,
294
- COMMUTATOR = >=,
295
- NEGATOR = >,
296
- RESTRICT = scalarlesel,
297
- JOIN = scalarlejoinsel
298
- );
299
-
300
- CREATE OPERATOR >= (
301
- PROCEDURE="ore_64_8_v1_gte",
302
- LEFTARG=ore_64_8_v1,
303
- RIGHTARG=ore_64_8_v1,
304
- COMMUTATOR = <=,
305
- NEGATOR = <,
306
- RESTRICT = scalarlesel,
307
- JOIN = scalarlejoinsel
308
- );
309
-
310
- CREATE OPERATOR FAMILY ore_64_8_v1_btree_ops USING btree;
311
- CREATE OPERATOR CLASS ore_64_8_v1_btree_ops DEFAULT FOR TYPE ore_64_8_v1 USING btree FAMILY ore_64_8_v1_btree_ops AS
312
- OPERATOR 1 <,
313
- OPERATOR 2 <=,
314
- OPERATOR 3 =,
315
- OPERATOR 4 >=,
316
- OPERATOR 5 >,
317
- FUNCTION 1 compare_ore_64_8_v1(a ore_64_8_v1, b ore_64_8_v1);
@@ -1,20 +0,0 @@
1
- -- TODO: what happens if we try to uninstall a type which is in use?
2
- DROP OPERATOR IF EXISTS = (ore_64_8_v1_term, ore_64_8_v1_term) CASCADE;
3
- DROP OPERATOR IF EXISTS <> (ore_64_8_v1_term, ore_64_8_v1_term) CASCADE;
4
- DROP OPERATOR IF EXISTS > (ore_64_8_v1_term, ore_64_8_v1_term) CASCADE;
5
- DROP OPERATOR IF EXISTS < (ore_64_8_v1_term, ore_64_8_v1_term) CASCADE;
6
- DROP OPERATOR IF EXISTS <= (ore_64_8_v1_term, ore_64_8_v1_term) CASCADE;
7
- DROP OPERATOR IF EXISTS >= (ore_64_8_v1_term, ore_64_8_v1_term) CASCADE;
8
- DROP OPERATOR CLASS IF EXISTS ore_64_8_v1_term_btree_ops USING btree CASCADE;
9
- DROP OPERATOR FAMILY IF EXISTS ore_64_8_v1_term_btree_ops USING btree CASCADE;
10
- DROP TYPE IF EXISTS ore_64_8_v1_term CASCADE;
11
-
12
- DROP OPERATOR IF EXISTS = (ore_64_8_v1, ore_64_8_v1) CASCADE;
13
- DROP OPERATOR IF EXISTS <> (ore_64_8_v1, ore_64_8_v1) CASCADE;
14
- DROP OPERATOR IF EXISTS > (ore_64_8_v1, ore_64_8_v1) CASCADE;
15
- DROP OPERATOR IF EXISTS < (ore_64_8_v1, ore_64_8_v1) CASCADE;
16
- DROP OPERATOR IF EXISTS <= (ore_64_8_v1, ore_64_8_v1) CASCADE;
17
- DROP OPERATOR IF EXISTS >= (ore_64_8_v1, ore_64_8_v1) CASCADE;
18
- DROP OPERATOR CLASS IF EXISTS ore_64_8_v1_btree_ops USING btree CASCADE;
19
- DROP OPERATOR FAMILY IF EXISTS ore_64_8_v1_btree_ops USING btree CASCADE;
20
- DROP TYPE IF EXISTS ore_64_8_v1 CASCADE;