-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpgs_gist.sql.in
489 lines (434 loc) · 16.7 KB
/
pgs_gist.sql.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
-- Spherical key definition'
CREATE FUNCTION spherekey_in(CSTRING)
RETURNS spherekey
AS 'MODULE_PATHNAME'
LANGUAGE 'c'
WITH (isstrict,iscachable);
CREATE FUNCTION spherekey_out(spherekey)
RETURNS CSTRING
AS 'MODULE_PATHNAME'
LANGUAGE 'c'
WITH (isstrict,iscachable);
CREATE TYPE spherekey (
internallength = 24,
input = spherekey_in,
output = spherekey_out
);
-- GIST common
CREATE FUNCTION g_spherekey_decompress(internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spherekey_decompress'
LANGUAGE 'C';
CREATE FUNCTION g_spherekey_union(bytea, internal)
RETURNS spherekey
AS 'MODULE_PATHNAME' , 'g_spherekey_union'
LANGUAGE 'C';
CREATE FUNCTION g_spherekey_penalty (internal,internal,internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spherekey_penalty'
LANGUAGE 'C' with (isstrict);
CREATE FUNCTION g_spherekey_picksplit(internal, internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spherekey_picksplit'
LANGUAGE 'C';
CREATE FUNCTION g_spherekey_same (spherekey,spherekey,internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spherekey_same'
LANGUAGE 'C';
-- create the operator class for spherical points
CREATE FUNCTION g_spoint_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spoint_compress'
LANGUAGE 'C';
--ifversion < v80400
CREATE FUNCTION g_spoint_consistent(internal, internal, int4)
--elseversion
CREATE FUNCTION g_spoint_consistent(internal, internal, int4, oid, internal)
--endifversion
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spoint_consistent'
LANGUAGE 'C';
CREATE OPERATOR CLASS spoint
DEFAULT FOR TYPE spoint USING gist AS
--ifversion < v80400
OPERATOR 1 = (spoint, spoint) RECHECK,
OPERATOR 11 @ (spoint, scircle) RECHECK,
OPERATOR 12 @ (spoint, sline) RECHECK,
OPERATOR 13 @ (spoint, spath) RECHECK,
OPERATOR 14 @ (spoint, spoly) RECHECK,
OPERATOR 15 @ (spoint, sellipse) RECHECK,
OPERATOR 16 @ (spoint, sbox) RECHECK,
FUNCTION 1 g_spoint_consistent (internal, internal, int4),
--elseversion
OPERATOR 1 = (spoint, spoint),
OPERATOR 11 @ (spoint, scircle),
OPERATOR 12 @ (spoint, sline),
OPERATOR 13 @ (spoint, spath),
OPERATOR 14 @ (spoint, spoly),
OPERATOR 15 @ (spoint, sellipse),
OPERATOR 16 @ (spoint, sbox),
FUNCTION 1 g_spoint_consistent (internal, internal, int4, oid, internal),
--endifversion
FUNCTION 2 g_spherekey_union (bytea, internal),
FUNCTION 3 g_spoint_compress (internal),
FUNCTION 4 g_spherekey_decompress (internal),
FUNCTION 5 g_spherekey_penalty (internal, internal, internal),
FUNCTION 6 g_spherekey_picksplit (internal, internal),
FUNCTION 7 g_spherekey_same (spherekey, spherekey, internal),
STORAGE spherekey;
-- create the operator class for spherical circle
CREATE FUNCTION g_scircle_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_scircle_compress'
LANGUAGE 'C';
--ifversion < v80400
CREATE FUNCTION g_scircle_consistent(internal, internal, int4)
--elseversion
CREATE FUNCTION g_scircle_consistent(internal, internal, int4, oid, internal)
--endifversion
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_scircle_consistent'
LANGUAGE 'C';
CREATE OPERATOR CLASS scircle
DEFAULT FOR TYPE scircle USING gist AS
--ifversion < v80400
OPERATOR 1 = (scircle, scircle) RECHECK,
OPERATOR 11 @ (scircle, scircle) RECHECK,
OPERATOR 12 @ (scircle, spoly) RECHECK,
OPERATOR 13 @ (scircle, sellipse) RECHECK,
OPERATOR 14 @ (scircle, sbox) RECHECK,
OPERATOR 21 ~ (scircle, spoint) RECHECK,
OPERATOR 22 ~ (scircle, scircle) RECHECK,
OPERATOR 23 ~ (scircle, sline) RECHECK,
OPERATOR 24 ~ (scircle, spath) RECHECK,
OPERATOR 25 ~ (scircle, spoly) RECHECK,
OPERATOR 26 ~ (scircle, sellipse) RECHECK,
OPERATOR 27 ~ (scircle, sbox) RECHECK,
OPERATOR 31 && (scircle, scircle) RECHECK,
OPERATOR 32 && (scircle, sline) RECHECK,
OPERATOR 33 && (scircle, spath) RECHECK,
OPERATOR 34 && (scircle, spoly) RECHECK,
OPERATOR 35 && (scircle, sellipse) RECHECK,
OPERATOR 36 && (scircle, sbox) RECHECK,
FUNCTION 1 g_scircle_consistent (internal, internal, int4),
--elseversion
OPERATOR 1 = (scircle, scircle),
OPERATOR 11 @ (scircle, scircle),
OPERATOR 12 @ (scircle, spoly),
OPERATOR 13 @ (scircle, sellipse),
OPERATOR 14 @ (scircle, sbox),
OPERATOR 21 ~ (scircle, spoint),
OPERATOR 22 ~ (scircle, scircle),
OPERATOR 23 ~ (scircle, sline),
OPERATOR 24 ~ (scircle, spath),
OPERATOR 25 ~ (scircle, spoly),
OPERATOR 26 ~ (scircle, sellipse),
OPERATOR 27 ~ (scircle, sbox),
OPERATOR 31 && (scircle, scircle),
OPERATOR 32 && (scircle, sline),
OPERATOR 33 && (scircle, spath),
OPERATOR 34 && (scircle, spoly),
OPERATOR 35 && (scircle, sellipse),
OPERATOR 36 && (scircle, sbox),
FUNCTION 1 g_scircle_consistent (internal, internal, int4, oid, internal),
--endifversion
FUNCTION 2 g_spherekey_union (bytea, internal),
FUNCTION 3 g_scircle_compress (internal),
FUNCTION 4 g_spherekey_decompress (internal),
FUNCTION 5 g_spherekey_penalty (internal, internal, internal),
FUNCTION 6 g_spherekey_picksplit (internal, internal),
FUNCTION 7 g_spherekey_same (spherekey, spherekey, internal),
STORAGE spherekey;
-- create the operator class for spherical line
CREATE FUNCTION g_sline_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_sline_compress'
LANGUAGE 'C';
--ifversion < v80400
CREATE FUNCTION g_sline_consistent(internal, internal, int4)
--elseversion
CREATE FUNCTION g_sline_consistent(internal, internal, int4, oid, internal)
--endifversion
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_sline_consistent'
LANGUAGE 'C';
CREATE OPERATOR CLASS sline
DEFAULT FOR TYPE sline USING gist AS
--ifversion < v80400
OPERATOR 1 = (sline, sline) RECHECK,
OPERATOR 2 # (sline, sline) RECHECK,
OPERATOR 11 @ (sline, scircle) RECHECK,
OPERATOR 12 @ (sline, spoly) RECHECK,
OPERATOR 13 @ (sline, sellipse) RECHECK,
OPERATOR 14 @ (sline, sbox) RECHECK,
OPERATOR 21 ~ (sline, spoint) RECHECK,
OPERATOR 31 && (sline, scircle) RECHECK,
OPERATOR 32 && (sline, sline) RECHECK,
OPERATOR 33 && (sline, spath) RECHECK,
OPERATOR 34 && (sline, spoly) RECHECK,
OPERATOR 35 && (sline, sellipse) RECHECK,
OPERATOR 36 && (sline, sbox) RECHECK,
FUNCTION 1 g_sline_consistent (internal, internal, int4),
--elseversion
OPERATOR 1 = (sline, sline),
OPERATOR 2 # (sline, sline),
OPERATOR 11 @ (sline, scircle),
OPERATOR 12 @ (sline, spoly),
OPERATOR 13 @ (sline, sellipse),
OPERATOR 14 @ (sline, sbox),
OPERATOR 21 ~ (sline, spoint),
OPERATOR 31 && (sline, scircle),
OPERATOR 32 && (sline, sline),
OPERATOR 33 && (sline, spath),
OPERATOR 34 && (sline, spoly),
OPERATOR 35 && (sline, sellipse),
OPERATOR 36 && (sline, sbox),
FUNCTION 1 g_sline_consistent (internal, internal, int4, oid, internal),
--endifversion
FUNCTION 2 g_spherekey_union (bytea, internal),
FUNCTION 3 g_sline_compress (internal),
FUNCTION 4 g_spherekey_decompress (internal),
FUNCTION 5 g_spherekey_penalty (internal, internal, internal),
FUNCTION 6 g_spherekey_picksplit (internal, internal),
FUNCTION 7 g_spherekey_same (spherekey, spherekey, internal),
STORAGE spherekey;
-- create the operator class for spherical ellipse
CREATE FUNCTION g_sellipse_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_sellipse_compress'
LANGUAGE 'C';
--ifversion < v80400
CREATE FUNCTION g_sellipse_consistent(internal, internal, int4)
--elseversion
CREATE FUNCTION g_sellipse_consistent(internal, internal, int4, oid, internal)
--endifversion
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_sellipse_consistent'
LANGUAGE 'C';
CREATE OPERATOR CLASS sellipse
DEFAULT FOR TYPE sellipse USING gist AS
--ifversion < v80400
OPERATOR 1 = (sellipse, sellipse) RECHECK,
OPERATOR 11 @ (sellipse, scircle) RECHECK,
OPERATOR 12 @ (sellipse, spoly) RECHECK,
OPERATOR 13 @ (sellipse, sellipse) RECHECK,
OPERATOR 14 @ (sellipse, sbox) RECHECK,
OPERATOR 21 ~ (sellipse, spoint) RECHECK,
OPERATOR 22 ~ (sellipse, scircle) RECHECK,
OPERATOR 23 ~ (sellipse, sline) RECHECK,
OPERATOR 24 ~ (sellipse, spath) RECHECK,
OPERATOR 25 ~ (sellipse, spoly) RECHECK,
OPERATOR 26 ~ (sellipse, sellipse) RECHECK,
OPERATOR 27 ~ (sellipse, sbox) RECHECK,
OPERATOR 31 && (sellipse, scircle) RECHECK,
OPERATOR 32 && (sellipse, sline) RECHECK,
OPERATOR 33 && (sellipse, spath) RECHECK,
OPERATOR 34 && (sellipse, spoly) RECHECK,
OPERATOR 35 && (sellipse, sellipse) RECHECK,
OPERATOR 36 && (sellipse, sbox) RECHECK,
FUNCTION 1 g_sellipse_consistent (internal, internal, int4),
--elseversion
OPERATOR 1 = (sellipse, sellipse),
OPERATOR 11 @ (sellipse, scircle),
OPERATOR 12 @ (sellipse, spoly),
OPERATOR 13 @ (sellipse, sellipse),
OPERATOR 14 @ (sellipse, sbox),
OPERATOR 21 ~ (sellipse, spoint),
OPERATOR 22 ~ (sellipse, scircle),
OPERATOR 23 ~ (sellipse, sline),
OPERATOR 24 ~ (sellipse, spath),
OPERATOR 25 ~ (sellipse, spoly),
OPERATOR 26 ~ (sellipse, sellipse),
OPERATOR 27 ~ (sellipse, sbox),
OPERATOR 31 && (sellipse, scircle),
OPERATOR 32 && (sellipse, sline),
OPERATOR 33 && (sellipse, spath),
OPERATOR 34 && (sellipse, spoly),
OPERATOR 35 && (sellipse, sellipse),
OPERATOR 36 && (sellipse, sbox),
FUNCTION 1 g_sellipse_consistent (internal, internal, int4, oid, internal),
--endifversion
FUNCTION 2 g_spherekey_union (bytea, internal),
FUNCTION 3 g_sellipse_compress (internal),
FUNCTION 4 g_spherekey_decompress (internal),
FUNCTION 5 g_spherekey_penalty (internal, internal, internal),
FUNCTION 6 g_spherekey_picksplit (internal, internal),
FUNCTION 7 g_spherekey_same (spherekey, spherekey, internal),
STORAGE spherekey;
-- create the operator class for spherical polygon
CREATE FUNCTION g_spoly_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spoly_compress'
LANGUAGE 'C';
--ifversion < v80400
CREATE FUNCTION g_spoly_consistent(internal, internal, int4)
--elseversion
CREATE FUNCTION g_spoly_consistent(internal, internal, int4, oid, internal)
--endifversion
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spoly_consistent'
LANGUAGE 'C';
CREATE OPERATOR CLASS spoly
DEFAULT FOR TYPE spoly USING gist AS
--ifversion < v80400
OPERATOR 1 = (spoly, spoly) RECHECK,
OPERATOR 11 @ (spoly, scircle) RECHECK,
OPERATOR 12 @ (spoly, spoly) RECHECK,
OPERATOR 13 @ (spoly, sellipse) RECHECK,
OPERATOR 14 @ (spoly, sbox) RECHECK,
OPERATOR 21 ~ (spoly, spoint) RECHECK,
OPERATOR 22 ~ (spoly, scircle) RECHECK,
OPERATOR 23 ~ (spoly, sline) RECHECK,
OPERATOR 24 ~ (spoly, spath) RECHECK,
OPERATOR 25 ~ (spoly, spoly) RECHECK,
OPERATOR 26 ~ (spoly, sellipse) RECHECK,
OPERATOR 27 ~ (spoly, sbox) RECHECK,
OPERATOR 31 && (spoly, scircle) RECHECK,
OPERATOR 32 && (spoly, sline) RECHECK,
OPERATOR 33 && (spoly, spath) RECHECK,
OPERATOR 34 && (spoly, spoly) RECHECK,
OPERATOR 35 && (spoly, sellipse) RECHECK,
OPERATOR 36 && (spoly, sbox) RECHECK,
FUNCTION 1 g_spoly_consistent (internal, internal, int4),
--elseversion
OPERATOR 1 = (spoly, spoly),
OPERATOR 11 @ (spoly, scircle),
OPERATOR 12 @ (spoly, spoly),
OPERATOR 13 @ (spoly, sellipse),
OPERATOR 14 @ (spoly, sbox),
OPERATOR 21 ~ (spoly, spoint),
OPERATOR 22 ~ (spoly, scircle),
OPERATOR 23 ~ (spoly, sline),
OPERATOR 24 ~ (spoly, spath),
OPERATOR 25 ~ (spoly, spoly),
OPERATOR 26 ~ (spoly, sellipse),
OPERATOR 27 ~ (spoly, sbox),
OPERATOR 31 && (spoly, scircle),
OPERATOR 32 && (spoly, sline),
OPERATOR 33 && (spoly, spath),
OPERATOR 34 && (spoly, spoly),
OPERATOR 35 && (spoly, sellipse),
OPERATOR 36 && (spoly, sbox),
FUNCTION 1 g_spoly_consistent (internal, internal, int4, oid, internal),
--endifversion
FUNCTION 2 g_spherekey_union (bytea, internal),
FUNCTION 3 g_spoly_compress (internal),
FUNCTION 4 g_spherekey_decompress (internal),
FUNCTION 5 g_spherekey_penalty (internal, internal, internal),
FUNCTION 6 g_spherekey_picksplit (internal, internal),
FUNCTION 7 g_spherekey_same (spherekey, spherekey, internal),
STORAGE spherekey;
-- create the operator class for spherical path
CREATE FUNCTION g_spath_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spath_compress'
LANGUAGE 'C';
--ifversion < v80400
CREATE FUNCTION g_spath_consistent(internal, internal, int4)
--elseversion
CREATE FUNCTION g_spath_consistent(internal, internal, int4, oid, internal)
--endifversion
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_spath_consistent'
LANGUAGE 'C';
CREATE OPERATOR CLASS spath
DEFAULT FOR TYPE spath USING gist AS
--ifversion < v80400
OPERATOR 1 = (spath, spath) RECHECK,
OPERATOR 11 @ (spath, scircle) RECHECK,
OPERATOR 12 @ (spath, spoly) RECHECK,
OPERATOR 13 @ (spath, sellipse) RECHECK,
OPERATOR 14 @ (spath, sbox) RECHECK,
OPERATOR 21 ~ (spath, spoint) RECHECK,
OPERATOR 31 && (spath, scircle) RECHECK,
OPERATOR 32 && (spath, sline) RECHECK,
OPERATOR 33 && (spath, spath) RECHECK,
OPERATOR 34 && (spath, spoly) RECHECK,
OPERATOR 35 && (spath, sellipse) RECHECK,
OPERATOR 36 && (spath, sbox) RECHECK,
FUNCTION 1 g_spath_consistent (internal, internal, int4),
--elseversion
OPERATOR 1 = (spath, spath),
OPERATOR 11 @ (spath, scircle),
OPERATOR 12 @ (spath, spoly),
OPERATOR 13 @ (spath, sellipse),
OPERATOR 14 @ (spath, sbox),
OPERATOR 21 ~ (spath, spoint),
OPERATOR 31 && (spath, scircle),
OPERATOR 32 && (spath, sline),
OPERATOR 33 && (spath, spath),
OPERATOR 34 && (spath, spoly),
OPERATOR 35 && (spath, sellipse),
OPERATOR 36 && (spath, sbox),
FUNCTION 1 g_spath_consistent (internal, internal, int4, oid, internal),
--endifversion
FUNCTION 2 g_spherekey_union (bytea, internal),
FUNCTION 3 g_spath_compress (internal),
FUNCTION 4 g_spherekey_decompress (internal),
FUNCTION 5 g_spherekey_penalty (internal, internal, internal),
FUNCTION 6 g_spherekey_picksplit (internal, internal),
FUNCTION 7 g_spherekey_same (spherekey, spherekey, internal),
STORAGE spherekey;
-- create the operator class for spherical box
CREATE FUNCTION g_sbox_compress(internal)
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_sbox_compress'
LANGUAGE 'C';
--ifversion < v80400
CREATE FUNCTION g_sbox_consistent(internal, internal, int4)
--elseversion
CREATE FUNCTION g_sbox_consistent(internal, internal, int4, oid, internal)
--endifversion
RETURNS internal
AS 'MODULE_PATHNAME' , 'g_sbox_consistent'
LANGUAGE 'C';
CREATE OPERATOR CLASS sbox
DEFAULT FOR TYPE sbox USING gist AS
--ifversion < v80400
OPERATOR 1 = (sbox, sbox) RECHECK,
OPERATOR 11 @ (sbox, scircle) RECHECK,
OPERATOR 12 @ (sbox, spoly) RECHECK,
OPERATOR 13 @ (sbox, sellipse) RECHECK,
OPERATOR 14 @ (sbox, sbox) RECHECK,
OPERATOR 21 ~ (sbox, spoint) RECHECK,
OPERATOR 22 ~ (sbox, scircle) RECHECK,
OPERATOR 23 ~ (sbox, sline) RECHECK,
OPERATOR 24 ~ (sbox, spath) RECHECK,
OPERATOR 25 ~ (sbox, spoly) RECHECK,
OPERATOR 26 ~ (sbox, sellipse) RECHECK,
OPERATOR 27 ~ (sbox, sbox) RECHECK,
OPERATOR 31 && (sbox, scircle) RECHECK,
OPERATOR 32 && (sbox, sline) RECHECK,
OPERATOR 33 && (sbox, spath) RECHECK,
OPERATOR 34 && (sbox, spoly) RECHECK,
OPERATOR 35 && (sbox, sellipse) RECHECK,
OPERATOR 36 && (sbox, sbox) RECHECK,
FUNCTION 1 g_sbox_consistent (internal, internal, int4),
--elseversion
OPERATOR 1 = (sbox, sbox),
OPERATOR 11 @ (sbox, scircle),
OPERATOR 12 @ (sbox, spoly),
OPERATOR 13 @ (sbox, sellipse),
OPERATOR 14 @ (sbox, sbox),
OPERATOR 21 ~ (sbox, spoint),
OPERATOR 22 ~ (sbox, scircle),
OPERATOR 23 ~ (sbox, sline),
OPERATOR 24 ~ (sbox, spath),
OPERATOR 25 ~ (sbox, spoly),
OPERATOR 26 ~ (sbox, sellipse),
OPERATOR 27 ~ (sbox, sbox),
OPERATOR 31 && (sbox, scircle),
OPERATOR 32 && (sbox, sline),
OPERATOR 33 && (sbox, spath),
OPERATOR 34 && (sbox, spoly),
OPERATOR 35 && (sbox, sellipse),
OPERATOR 36 && (sbox, sbox),
FUNCTION 1 g_sbox_consistent (internal, internal, int4, oid, internal),
--endifversion
FUNCTION 2 g_spherekey_union (bytea, internal),
FUNCTION 3 g_sbox_compress (internal),
FUNCTION 4 g_spherekey_decompress (internal),
FUNCTION 5 g_spherekey_penalty (internal, internal, internal),
FUNCTION 6 g_spherekey_picksplit (internal, internal),
FUNCTION 7 g_spherekey_same (spherekey, spherekey, internal),
STORAGE spherekey;