-
Notifications
You must be signed in to change notification settings - Fork 2
/
001-identifiers.sql
557 lines (554 loc) · 87.5 KB
/
001-identifiers.sql
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
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
create type meta.cast_id as (source_type_schema_name text,source_type_name text,target_type_schema_name text,target_type_name text);
create function meta.cast_id(source_type_schema_name text,source_type_name text,target_type_schema_name text,target_type_name text) returns meta.cast_id as $_$ select row(source_type_schema_name,source_type_name,target_type_schema_name,target_type_name)::meta.cast_id $_$ immutable language sql;
create function meta.meta_id(cast_id meta.cast_id) returns meta.meta_id as $_$ select meta.meta_id('cast'); $_$ immutable language sql;
create function meta.cast_id(value jsonb) returns meta.cast_id as $_$select meta.cast_id((value->>'source_type_schema_name')::text, (value->>'source_type_name')::text, (value->>'target_type_schema_name')::text, (value->>'target_type_name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.cast_id, rightarg jsonb) returns boolean as $_$select ((leftarg).source_type_schema_name)::text = (rightarg)->>'source_type_schema_name' and ((leftarg).source_type_name)::text = (rightarg)->>'source_type_name' and ((leftarg).target_type_schema_name)::text = (rightarg)->>'target_type_schema_name' and ((leftarg).target_type_name)::text = (rightarg)->>'target_type_name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.cast_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.cast_id) with function meta.cast_id(jsonb) as assignment;
create function meta.cast_id_to_jsonb(value meta.cast_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.cast_id) returns boolean as $_$select (leftarg)->>'source_type_schema_name' = ((rightarg).source_type_schema_name)::text and (leftarg)->>'source_type_name' = ((rightarg).source_type_name)::text and (leftarg)->>'target_type_schema_name' = ((rightarg).target_type_schema_name)::text and (leftarg)->>'target_type_name' = ((rightarg).target_type_name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.cast_id, procedure = meta.eq);
create cast (meta.cast_id as jsonb) with function meta.cast_id_to_jsonb(meta.cast_id) as assignment;
create function meta.cast_id(value json) returns meta.cast_id as $_$select meta.cast_id((value->>'source_type_schema_name')::text, (value->>'source_type_name')::text, (value->>'target_type_schema_name')::text, (value->>'target_type_name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.cast_id, rightarg json) returns boolean as $_$select ((leftarg).source_type_schema_name)::text = ((rightarg)->>'source_type_schema_name')::text and ((leftarg).source_type_name)::text = ((rightarg)->>'source_type_name')::text and ((leftarg).target_type_schema_name)::text = ((rightarg)->>'target_type_schema_name')::text and ((leftarg).target_type_name)::text = ((rightarg)->>'target_type_name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.cast_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.cast_id) with function meta.cast_id(json) as assignment;
create function meta.cast_id_to_json(value meta.cast_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.cast_id) returns boolean as $_$select (leftarg)->>'source_type_schema_name' = ((rightarg).source_type_schema_name)::text and (leftarg)->>'source_type_name' = ((rightarg).source_type_name)::text and (leftarg)->>'target_type_schema_name' = ((rightarg).target_type_schema_name)::text and (leftarg)->>'target_type_name' = ((rightarg).target_type_name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.cast_id, procedure = meta.eq);
create cast (meta.cast_id as json) with function meta.cast_id_to_json(meta.cast_id) as assignment;
create type meta.column_id as (schema_name text,relation_name text,name text);
create function meta.column_id(schema_name text,relation_name text,name text) returns meta.column_id as $_$ select row(schema_name,relation_name,name)::meta.column_id $_$ immutable language sql;
create function meta.meta_id(column_id meta.column_id) returns meta.meta_id as $_$ select meta.meta_id('column'); $_$ immutable language sql;
create function meta.column_id(value jsonb) returns meta.column_id as $_$select meta.column_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.column_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).relation_name)::text = (rightarg)->>'relation_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.column_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.column_id) with function meta.column_id(jsonb) as assignment;
create function meta.column_id_to_jsonb(value meta.column_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.column_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.column_id, procedure = meta.eq);
create cast (meta.column_id as jsonb) with function meta.column_id_to_jsonb(meta.column_id) as assignment;
create function meta.column_id(value json) returns meta.column_id as $_$select meta.column_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.column_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).relation_name)::text = ((rightarg)->>'relation_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.column_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.column_id) with function meta.column_id(json) as assignment;
create function meta.column_id_to_json(value meta.column_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.column_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.column_id, procedure = meta.eq);
create cast (meta.column_id as json) with function meta.column_id_to_json(meta.column_id) as assignment;
create type meta.connection_id as (pid int4,connection_start timestamptz);
create function meta.connection_id(pid int4,connection_start timestamptz) returns meta.connection_id as $_$ select row(pid,connection_start)::meta.connection_id $_$ immutable language sql;
create function meta.meta_id(connection_id meta.connection_id) returns meta.meta_id as $_$ select meta.meta_id('connection'); $_$ immutable language sql;
create function meta.connection_id(value jsonb) returns meta.connection_id as $_$select meta.connection_id((value->>'pid')::int4, (value->>'connection_start')::timestamptz) $_$ immutable language sql;
create function meta.eq(leftarg meta.connection_id, rightarg jsonb) returns boolean as $_$select ((leftarg).pid)::text = (rightarg)->>'pid' and ((leftarg).connection_start)::text = (rightarg)->>'connection_start'$_$ immutable language sql;
create operator meta.= (leftarg = meta.connection_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.connection_id) with function meta.connection_id(jsonb) as assignment;
create function meta.connection_id_to_jsonb(value meta.connection_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.connection_id) returns boolean as $_$select (leftarg)->>'pid' = ((rightarg).pid)::text and (leftarg)->>'connection_start' = ((rightarg).connection_start)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.connection_id, procedure = meta.eq);
create cast (meta.connection_id as jsonb) with function meta.connection_id_to_jsonb(meta.connection_id) as assignment;
create function meta.connection_id(value json) returns meta.connection_id as $_$select meta.connection_id((value->>'pid')::int4, (value->>'connection_start')::timestamptz) $_$ immutable language sql;
create function meta.eq(leftarg meta.connection_id, rightarg json) returns boolean as $_$select ((leftarg).pid)::text = ((rightarg)->>'pid')::text and ((leftarg).connection_start)::text = ((rightarg)->>'connection_start')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.connection_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.connection_id) with function meta.connection_id(json) as assignment;
create function meta.connection_id_to_json(value meta.connection_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.connection_id) returns boolean as $_$select (leftarg)->>'pid' = ((rightarg).pid)::text and (leftarg)->>'connection_start' = ((rightarg).connection_start)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.connection_id, procedure = meta.eq);
create cast (meta.connection_id as json) with function meta.connection_id_to_json(meta.connection_id) as assignment;
create type meta.constraint_id as (schema_name text,relation_name text,name text);
create function meta.constraint_id(schema_name text,relation_name text,name text) returns meta.constraint_id as $_$ select row(schema_name,relation_name,name)::meta.constraint_id $_$ immutable language sql;
create function meta.meta_id(constraint_id meta.constraint_id) returns meta.meta_id as $_$ select meta.meta_id('constraint'); $_$ immutable language sql;
create function meta.constraint_id(value jsonb) returns meta.constraint_id as $_$select meta.constraint_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.constraint_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).relation_name)::text = (rightarg)->>'relation_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.constraint_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.constraint_id) with function meta.constraint_id(jsonb) as assignment;
create function meta.constraint_id_to_jsonb(value meta.constraint_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.constraint_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.constraint_id, procedure = meta.eq);
create cast (meta.constraint_id as jsonb) with function meta.constraint_id_to_jsonb(meta.constraint_id) as assignment;
create function meta.constraint_id(value json) returns meta.constraint_id as $_$select meta.constraint_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.constraint_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).relation_name)::text = ((rightarg)->>'relation_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.constraint_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.constraint_id) with function meta.constraint_id(json) as assignment;
create function meta.constraint_id_to_json(value meta.constraint_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.constraint_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.constraint_id, procedure = meta.eq);
create cast (meta.constraint_id as json) with function meta.constraint_id_to_json(meta.constraint_id) as assignment;
create type meta.constraint_check_id as (schema_name text,table_name text,name text,column_names text);
create function meta.constraint_check_id(schema_name text,table_name text,name text,column_names text) returns meta.constraint_check_id as $_$ select row(schema_name,table_name,name,column_names)::meta.constraint_check_id $_$ immutable language sql;
create function meta.meta_id(constraint_check_id meta.constraint_check_id) returns meta.meta_id as $_$ select meta.meta_id('constraint_check'); $_$ immutable language sql;
create function meta.constraint_check_id(value jsonb) returns meta.constraint_check_id as $_$select meta.constraint_check_id((value->>'schema_name')::text, (value->>'table_name')::text, (value->>'name')::text, (value->>'column_names')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.constraint_check_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).table_name)::text = (rightarg)->>'table_name' and ((leftarg).name)::text = (rightarg)->>'name' and ((leftarg).column_names)::text = (rightarg)->>'column_names'$_$ immutable language sql;
create operator meta.= (leftarg = meta.constraint_check_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.constraint_check_id) with function meta.constraint_check_id(jsonb) as assignment;
create function meta.constraint_check_id_to_jsonb(value meta.constraint_check_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.constraint_check_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'table_name' = ((rightarg).table_name)::text and (leftarg)->>'name' = ((rightarg).name)::text and (leftarg)->>'column_names' = ((rightarg).column_names)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.constraint_check_id, procedure = meta.eq);
create cast (meta.constraint_check_id as jsonb) with function meta.constraint_check_id_to_jsonb(meta.constraint_check_id) as assignment;
create function meta.constraint_check_id(value json) returns meta.constraint_check_id as $_$select meta.constraint_check_id((value->>'schema_name')::text, (value->>'table_name')::text, (value->>'name')::text, (value->>'column_names')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.constraint_check_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).table_name)::text = ((rightarg)->>'table_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text and ((leftarg).column_names)::text = ((rightarg)->>'column_names')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.constraint_check_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.constraint_check_id) with function meta.constraint_check_id(json) as assignment;
create function meta.constraint_check_id_to_json(value meta.constraint_check_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.constraint_check_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'table_name' = ((rightarg).table_name)::text and (leftarg)->>'name' = ((rightarg).name)::text and (leftarg)->>'column_names' = ((rightarg).column_names)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.constraint_check_id, procedure = meta.eq);
create cast (meta.constraint_check_id as json) with function meta.constraint_check_id_to_json(meta.constraint_check_id) as assignment;
create type meta.constraint_unique_id as (schema_name text,table_name text,name text,column_names text);
create function meta.constraint_unique_id(schema_name text,table_name text,name text,column_names text) returns meta.constraint_unique_id as $_$ select row(schema_name,table_name,name,column_names)::meta.constraint_unique_id $_$ immutable language sql;
create function meta.meta_id(constraint_unique_id meta.constraint_unique_id) returns meta.meta_id as $_$ select meta.meta_id('constraint_unique'); $_$ immutable language sql;
create function meta.constraint_unique_id(value jsonb) returns meta.constraint_unique_id as $_$select meta.constraint_unique_id((value->>'schema_name')::text, (value->>'table_name')::text, (value->>'name')::text, (value->>'column_names')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.constraint_unique_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).table_name)::text = (rightarg)->>'table_name' and ((leftarg).name)::text = (rightarg)->>'name' and ((leftarg).column_names)::text = (rightarg)->>'column_names'$_$ immutable language sql;
create operator meta.= (leftarg = meta.constraint_unique_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.constraint_unique_id) with function meta.constraint_unique_id(jsonb) as assignment;
create function meta.constraint_unique_id_to_jsonb(value meta.constraint_unique_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.constraint_unique_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'table_name' = ((rightarg).table_name)::text and (leftarg)->>'name' = ((rightarg).name)::text and (leftarg)->>'column_names' = ((rightarg).column_names)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.constraint_unique_id, procedure = meta.eq);
create cast (meta.constraint_unique_id as jsonb) with function meta.constraint_unique_id_to_jsonb(meta.constraint_unique_id) as assignment;
create function meta.constraint_unique_id(value json) returns meta.constraint_unique_id as $_$select meta.constraint_unique_id((value->>'schema_name')::text, (value->>'table_name')::text, (value->>'name')::text, (value->>'column_names')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.constraint_unique_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).table_name)::text = ((rightarg)->>'table_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text and ((leftarg).column_names)::text = ((rightarg)->>'column_names')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.constraint_unique_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.constraint_unique_id) with function meta.constraint_unique_id(json) as assignment;
create function meta.constraint_unique_id_to_json(value meta.constraint_unique_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.constraint_unique_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'table_name' = ((rightarg).table_name)::text and (leftarg)->>'name' = ((rightarg).name)::text and (leftarg)->>'column_names' = ((rightarg).column_names)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.constraint_unique_id, procedure = meta.eq);
create cast (meta.constraint_unique_id as json) with function meta.constraint_unique_id_to_json(meta.constraint_unique_id) as assignment;
create type meta.extension_id as (name text);
create function meta.extension_id(name text) returns meta.extension_id as $_$ select row(name)::meta.extension_id $_$ immutable language sql;
create function meta.meta_id(extension_id meta.extension_id) returns meta.meta_id as $_$ select meta.meta_id('extension'); $_$ immutable language sql;
create function meta.extension_id(value jsonb) returns meta.extension_id as $_$select meta.extension_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.extension_id, rightarg jsonb) returns boolean as $_$select ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.extension_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.extension_id) with function meta.extension_id(jsonb) as assignment;
create function meta.extension_id_to_jsonb(value meta.extension_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.extension_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.extension_id, procedure = meta.eq);
create cast (meta.extension_id as jsonb) with function meta.extension_id_to_jsonb(meta.extension_id) as assignment;
create function meta.extension_id(value json) returns meta.extension_id as $_$select meta.extension_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.extension_id, rightarg json) returns boolean as $_$select ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.extension_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.extension_id) with function meta.extension_id(json) as assignment;
create function meta.extension_id_to_json(value meta.extension_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.extension_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.extension_id, procedure = meta.eq);
create cast (meta.extension_id as json) with function meta.extension_id_to_json(meta.extension_id) as assignment;
create type meta.field_id as (schema_name text,relation_name text,pk_column_names text[],pk_values text[],column_name text);
create function meta.field_id(schema_name text,relation_name text,pk_column_names text[],pk_values text[],column_name text) returns meta.field_id as $_$ select row(schema_name,relation_name,pk_column_names,pk_values,column_name)::meta.field_id $_$ immutable language sql;
create function meta.meta_id(field_id meta.field_id) returns meta.meta_id as $_$ select meta.meta_id('field'); $_$ immutable language sql;
create function meta.field_id(value jsonb) returns meta.field_id as $_$select meta.field_id((value->>'schema_name')::text, (value->>'relation_name')::text, (select array_agg(value) from jsonb_array_elements_text(value->'pk_column_names')), (select array_agg(value) from jsonb_array_elements_text(value->'pk_values')), (value->>'column_name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.field_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).relation_name)::text = (rightarg)->>'relation_name' and to_jsonb((leftarg).pk_column_names) = rightarg->'pk_column_names' and to_jsonb((leftarg).pk_values) = rightarg->'pk_values' and ((leftarg).column_name)::text = (rightarg)->>'column_name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.field_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.field_id) with function meta.field_id(jsonb) as assignment;
create function meta.field_id_to_jsonb(value meta.field_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.field_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and leftarg->'pk_column_names' = to_jsonb((rightarg).pk_column_names) and leftarg->'pk_values' = to_jsonb((rightarg).pk_values) and (leftarg)->>'column_name' = ((rightarg).column_name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.field_id, procedure = meta.eq);
create cast (meta.field_id as jsonb) with function meta.field_id_to_jsonb(meta.field_id) as assignment;
create function meta.field_id(value json) returns meta.field_id as $_$select meta.field_id((value->>'schema_name')::text, (value->>'relation_name')::text, (select array_agg(value) from json_array_elements_text(value->'pk_column_names')), (select array_agg(value) from json_array_elements_text(value->'pk_values')), (value->>'column_name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.field_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).relation_name)::text = ((rightarg)->>'relation_name')::text and to_json((leftarg).pk_column_names)::text = (rightarg->'pk_column_names')::text and to_json((leftarg).pk_values)::text = (rightarg->'pk_values')::text and ((leftarg).column_name)::text = ((rightarg)->>'column_name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.field_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.field_id) with function meta.field_id(json) as assignment;
create function meta.field_id_to_json(value meta.field_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.field_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg->'pk_column_names')::text = (to_json((rightarg).pk_column_names))::text and (leftarg->'pk_values')::text = (to_json((rightarg).pk_values))::text and (leftarg)->>'column_name' = ((rightarg).column_name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.field_id, procedure = meta.eq);
create cast (meta.field_id as json) with function meta.field_id_to_json(meta.field_id) as assignment;
create type meta.foreign_column_id as (schema_name text,name text);
create function meta.foreign_column_id(schema_name text,name text) returns meta.foreign_column_id as $_$ select row(schema_name,name)::meta.foreign_column_id $_$ immutable language sql;
create function meta.meta_id(foreign_column_id meta.foreign_column_id) returns meta.meta_id as $_$ select meta.meta_id('foreign_column'); $_$ immutable language sql;
create function meta.foreign_column_id(value jsonb) returns meta.foreign_column_id as $_$select meta.foreign_column_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_column_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_column_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.foreign_column_id) with function meta.foreign_column_id(jsonb) as assignment;
create function meta.foreign_column_id_to_jsonb(value meta.foreign_column_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.foreign_column_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.foreign_column_id, procedure = meta.eq);
create cast (meta.foreign_column_id as jsonb) with function meta.foreign_column_id_to_jsonb(meta.foreign_column_id) as assignment;
create function meta.foreign_column_id(value json) returns meta.foreign_column_id as $_$select meta.foreign_column_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_column_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_column_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.foreign_column_id) with function meta.foreign_column_id(json) as assignment;
create function meta.foreign_column_id_to_json(value meta.foreign_column_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.foreign_column_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.foreign_column_id, procedure = meta.eq);
create cast (meta.foreign_column_id as json) with function meta.foreign_column_id_to_json(meta.foreign_column_id) as assignment;
create type meta.foreign_data_wrapper_id as (name text);
create function meta.foreign_data_wrapper_id(name text) returns meta.foreign_data_wrapper_id as $_$ select row(name)::meta.foreign_data_wrapper_id $_$ immutable language sql;
create function meta.meta_id(foreign_data_wrapper_id meta.foreign_data_wrapper_id) returns meta.meta_id as $_$ select meta.meta_id('foreign_data_wrapper'); $_$ immutable language sql;
create function meta.foreign_data_wrapper_id(value jsonb) returns meta.foreign_data_wrapper_id as $_$select meta.foreign_data_wrapper_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_data_wrapper_id, rightarg jsonb) returns boolean as $_$select ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_data_wrapper_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.foreign_data_wrapper_id) with function meta.foreign_data_wrapper_id(jsonb) as assignment;
create function meta.foreign_data_wrapper_id_to_jsonb(value meta.foreign_data_wrapper_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.foreign_data_wrapper_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.foreign_data_wrapper_id, procedure = meta.eq);
create cast (meta.foreign_data_wrapper_id as jsonb) with function meta.foreign_data_wrapper_id_to_jsonb(meta.foreign_data_wrapper_id) as assignment;
create function meta.foreign_data_wrapper_id(value json) returns meta.foreign_data_wrapper_id as $_$select meta.foreign_data_wrapper_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_data_wrapper_id, rightarg json) returns boolean as $_$select ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_data_wrapper_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.foreign_data_wrapper_id) with function meta.foreign_data_wrapper_id(json) as assignment;
create function meta.foreign_data_wrapper_id_to_json(value meta.foreign_data_wrapper_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.foreign_data_wrapper_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.foreign_data_wrapper_id, procedure = meta.eq);
create cast (meta.foreign_data_wrapper_id as json) with function meta.foreign_data_wrapper_id_to_json(meta.foreign_data_wrapper_id) as assignment;
create type meta.foreign_key_id as (schema_name text,relation_name text,name text);
create function meta.foreign_key_id(schema_name text,relation_name text,name text) returns meta.foreign_key_id as $_$ select row(schema_name,relation_name,name)::meta.foreign_key_id $_$ immutable language sql;
create function meta.meta_id(foreign_key_id meta.foreign_key_id) returns meta.meta_id as $_$ select meta.meta_id('foreign_key'); $_$ immutable language sql;
create function meta.foreign_key_id(value jsonb) returns meta.foreign_key_id as $_$select meta.foreign_key_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_key_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).relation_name)::text = (rightarg)->>'relation_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_key_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.foreign_key_id) with function meta.foreign_key_id(jsonb) as assignment;
create function meta.foreign_key_id_to_jsonb(value meta.foreign_key_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.foreign_key_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.foreign_key_id, procedure = meta.eq);
create cast (meta.foreign_key_id as jsonb) with function meta.foreign_key_id_to_jsonb(meta.foreign_key_id) as assignment;
create function meta.foreign_key_id(value json) returns meta.foreign_key_id as $_$select meta.foreign_key_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_key_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).relation_name)::text = ((rightarg)->>'relation_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_key_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.foreign_key_id) with function meta.foreign_key_id(json) as assignment;
create function meta.foreign_key_id_to_json(value meta.foreign_key_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.foreign_key_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.foreign_key_id, procedure = meta.eq);
create cast (meta.foreign_key_id as json) with function meta.foreign_key_id_to_json(meta.foreign_key_id) as assignment;
create type meta.foreign_server_id as (name text);
create function meta.foreign_server_id(name text) returns meta.foreign_server_id as $_$ select row(name)::meta.foreign_server_id $_$ immutable language sql;
create function meta.meta_id(foreign_server_id meta.foreign_server_id) returns meta.meta_id as $_$ select meta.meta_id('foreign_server'); $_$ immutable language sql;
create function meta.foreign_server_id(value jsonb) returns meta.foreign_server_id as $_$select meta.foreign_server_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_server_id, rightarg jsonb) returns boolean as $_$select ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_server_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.foreign_server_id) with function meta.foreign_server_id(jsonb) as assignment;
create function meta.foreign_server_id_to_jsonb(value meta.foreign_server_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.foreign_server_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.foreign_server_id, procedure = meta.eq);
create cast (meta.foreign_server_id as jsonb) with function meta.foreign_server_id_to_jsonb(meta.foreign_server_id) as assignment;
create function meta.foreign_server_id(value json) returns meta.foreign_server_id as $_$select meta.foreign_server_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_server_id, rightarg json) returns boolean as $_$select ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_server_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.foreign_server_id) with function meta.foreign_server_id(json) as assignment;
create function meta.foreign_server_id_to_json(value meta.foreign_server_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.foreign_server_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.foreign_server_id, procedure = meta.eq);
create cast (meta.foreign_server_id as json) with function meta.foreign_server_id_to_json(meta.foreign_server_id) as assignment;
create type meta.foreign_table_id as (schema_name text,name text);
create function meta.foreign_table_id(schema_name text,name text) returns meta.foreign_table_id as $_$ select row(schema_name,name)::meta.foreign_table_id $_$ immutable language sql;
create function meta.meta_id(foreign_table_id meta.foreign_table_id) returns meta.meta_id as $_$ select meta.meta_id('foreign_table'); $_$ immutable language sql;
create function meta.foreign_table_id(value jsonb) returns meta.foreign_table_id as $_$select meta.foreign_table_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_table_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_table_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.foreign_table_id) with function meta.foreign_table_id(jsonb) as assignment;
create function meta.foreign_table_id_to_jsonb(value meta.foreign_table_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.foreign_table_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.foreign_table_id, procedure = meta.eq);
create cast (meta.foreign_table_id as jsonb) with function meta.foreign_table_id_to_jsonb(meta.foreign_table_id) as assignment;
create function meta.foreign_table_id(value json) returns meta.foreign_table_id as $_$select meta.foreign_table_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.foreign_table_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.foreign_table_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.foreign_table_id) with function meta.foreign_table_id(json) as assignment;
create function meta.foreign_table_id_to_json(value meta.foreign_table_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.foreign_table_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.foreign_table_id, procedure = meta.eq);
create cast (meta.foreign_table_id as json) with function meta.foreign_table_id_to_json(meta.foreign_table_id) as assignment;
create type meta.function_id as (schema_name text,name text,parameters text[]);
create function meta.function_id(schema_name text,name text,parameters text[]) returns meta.function_id as $_$ select row(schema_name,name,parameters)::meta.function_id $_$ immutable language sql;
create function meta.meta_id(function_id meta.function_id) returns meta.meta_id as $_$ select meta.meta_id('function'); $_$ immutable language sql;
create function meta.function_id(value jsonb) returns meta.function_id as $_$select meta.function_id((value->>'schema_name')::text, (value->>'name')::text, (select array_agg(value) from jsonb_array_elements_text(value->'parameters'))) $_$ immutable language sql;
create function meta.eq(leftarg meta.function_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).name)::text = (rightarg)->>'name' and to_jsonb((leftarg).parameters) = rightarg->'parameters'$_$ immutable language sql;
create operator meta.= (leftarg = meta.function_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.function_id) with function meta.function_id(jsonb) as assignment;
create function meta.function_id_to_jsonb(value meta.function_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.function_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text and leftarg->'parameters' = to_jsonb((rightarg).parameters)$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.function_id, procedure = meta.eq);
create cast (meta.function_id as jsonb) with function meta.function_id_to_jsonb(meta.function_id) as assignment;
create function meta.function_id(value json) returns meta.function_id as $_$select meta.function_id((value->>'schema_name')::text, (value->>'name')::text, (select array_agg(value) from json_array_elements_text(value->'parameters'))) $_$ immutable language sql;
create function meta.eq(leftarg meta.function_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text and to_json((leftarg).parameters)::text = (rightarg->'parameters')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.function_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.function_id) with function meta.function_id(json) as assignment;
create function meta.function_id_to_json(value meta.function_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.function_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text and (leftarg->'parameters')::text = (to_json((rightarg).parameters))::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.function_id, procedure = meta.eq);
create cast (meta.function_id as json) with function meta.function_id_to_json(meta.function_id) as assignment;
create type meta.operator_id as (schema_name text,name text,left_arg_type_schema_name text,left_arg_type_name text,right_arg_type_schema_name text,right_arg_type_name text);
create function meta.operator_id(schema_name text,name text,left_arg_type_schema_name text,left_arg_type_name text,right_arg_type_schema_name text,right_arg_type_name text) returns meta.operator_id as $_$ select row(schema_name,name,left_arg_type_schema_name,left_arg_type_name,right_arg_type_schema_name,right_arg_type_name)::meta.operator_id $_$ immutable language sql;
create function meta.meta_id(operator_id meta.operator_id) returns meta.meta_id as $_$ select meta.meta_id('operator'); $_$ immutable language sql;
create function meta.operator_id(value jsonb) returns meta.operator_id as $_$select meta.operator_id((value->>'schema_name')::text, (value->>'name')::text, (value->>'left_arg_type_schema_name')::text, (value->>'left_arg_type_name')::text, (value->>'right_arg_type_schema_name')::text, (value->>'right_arg_type_name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.operator_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).name)::text = (rightarg)->>'name' and ((leftarg).left_arg_type_schema_name)::text = (rightarg)->>'left_arg_type_schema_name' and ((leftarg).left_arg_type_name)::text = (rightarg)->>'left_arg_type_name' and ((leftarg).right_arg_type_schema_name)::text = (rightarg)->>'right_arg_type_schema_name' and ((leftarg).right_arg_type_name)::text = (rightarg)->>'right_arg_type_name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.operator_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.operator_id) with function meta.operator_id(jsonb) as assignment;
create function meta.operator_id_to_jsonb(value meta.operator_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.operator_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text and (leftarg)->>'left_arg_type_schema_name' = ((rightarg).left_arg_type_schema_name)::text and (leftarg)->>'left_arg_type_name' = ((rightarg).left_arg_type_name)::text and (leftarg)->>'right_arg_type_schema_name' = ((rightarg).right_arg_type_schema_name)::text and (leftarg)->>'right_arg_type_name' = ((rightarg).right_arg_type_name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.operator_id, procedure = meta.eq);
create cast (meta.operator_id as jsonb) with function meta.operator_id_to_jsonb(meta.operator_id) as assignment;
create function meta.operator_id(value json) returns meta.operator_id as $_$select meta.operator_id((value->>'schema_name')::text, (value->>'name')::text, (value->>'left_arg_type_schema_name')::text, (value->>'left_arg_type_name')::text, (value->>'right_arg_type_schema_name')::text, (value->>'right_arg_type_name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.operator_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text and ((leftarg).left_arg_type_schema_name)::text = ((rightarg)->>'left_arg_type_schema_name')::text and ((leftarg).left_arg_type_name)::text = ((rightarg)->>'left_arg_type_name')::text and ((leftarg).right_arg_type_schema_name)::text = ((rightarg)->>'right_arg_type_schema_name')::text and ((leftarg).right_arg_type_name)::text = ((rightarg)->>'right_arg_type_name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.operator_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.operator_id) with function meta.operator_id(json) as assignment;
create function meta.operator_id_to_json(value meta.operator_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.operator_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text and (leftarg)->>'left_arg_type_schema_name' = ((rightarg).left_arg_type_schema_name)::text and (leftarg)->>'left_arg_type_name' = ((rightarg).left_arg_type_name)::text and (leftarg)->>'right_arg_type_schema_name' = ((rightarg).right_arg_type_schema_name)::text and (leftarg)->>'right_arg_type_name' = ((rightarg).right_arg_type_name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.operator_id, procedure = meta.eq);
create cast (meta.operator_id as json) with function meta.operator_id_to_json(meta.operator_id) as assignment;
create type meta.policy_id as (schema_name text,relation_name text,name text);
create function meta.policy_id(schema_name text,relation_name text,name text) returns meta.policy_id as $_$ select row(schema_name,relation_name,name)::meta.policy_id $_$ immutable language sql;
create function meta.meta_id(policy_id meta.policy_id) returns meta.meta_id as $_$ select meta.meta_id('policy'); $_$ immutable language sql;
create function meta.policy_id(value jsonb) returns meta.policy_id as $_$select meta.policy_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.policy_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).relation_name)::text = (rightarg)->>'relation_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.policy_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.policy_id) with function meta.policy_id(jsonb) as assignment;
create function meta.policy_id_to_jsonb(value meta.policy_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.policy_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.policy_id, procedure = meta.eq);
create cast (meta.policy_id as jsonb) with function meta.policy_id_to_jsonb(meta.policy_id) as assignment;
create function meta.policy_id(value json) returns meta.policy_id as $_$select meta.policy_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.policy_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).relation_name)::text = ((rightarg)->>'relation_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.policy_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.policy_id) with function meta.policy_id(json) as assignment;
create function meta.policy_id_to_json(value meta.policy_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.policy_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.policy_id, procedure = meta.eq);
create cast (meta.policy_id as json) with function meta.policy_id_to_json(meta.policy_id) as assignment;
create type meta.relation_id as (schema_name text,name text);
create function meta.relation_id(schema_name text,name text) returns meta.relation_id as $_$ select row(schema_name,name)::meta.relation_id $_$ immutable language sql;
create function meta.meta_id(relation_id meta.relation_id) returns meta.meta_id as $_$ select meta.meta_id('relation'); $_$ immutable language sql;
create function meta.relation_id(value jsonb) returns meta.relation_id as $_$select meta.relation_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.relation_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.relation_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.relation_id) with function meta.relation_id(jsonb) as assignment;
create function meta.relation_id_to_jsonb(value meta.relation_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.relation_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.relation_id, procedure = meta.eq);
create cast (meta.relation_id as jsonb) with function meta.relation_id_to_jsonb(meta.relation_id) as assignment;
create function meta.relation_id(value json) returns meta.relation_id as $_$select meta.relation_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.relation_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.relation_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.relation_id) with function meta.relation_id(json) as assignment;
create function meta.relation_id_to_json(value meta.relation_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.relation_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.relation_id, procedure = meta.eq);
create cast (meta.relation_id as json) with function meta.relation_id_to_json(meta.relation_id) as assignment;
create type meta.role_id as (name text);
create function meta.role_id(name text) returns meta.role_id as $_$ select row(name)::meta.role_id $_$ immutable language sql;
create function meta.meta_id(role_id meta.role_id) returns meta.meta_id as $_$ select meta.meta_id('role'); $_$ immutable language sql;
create function meta.role_id(value jsonb) returns meta.role_id as $_$select meta.role_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.role_id, rightarg jsonb) returns boolean as $_$select ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.role_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.role_id) with function meta.role_id(jsonb) as assignment;
create function meta.role_id_to_jsonb(value meta.role_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.role_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.role_id, procedure = meta.eq);
create cast (meta.role_id as jsonb) with function meta.role_id_to_jsonb(meta.role_id) as assignment;
create function meta.role_id(value json) returns meta.role_id as $_$select meta.role_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.role_id, rightarg json) returns boolean as $_$select ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.role_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.role_id) with function meta.role_id(json) as assignment;
create function meta.role_id_to_json(value meta.role_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.role_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.role_id, procedure = meta.eq);
create cast (meta.role_id as json) with function meta.role_id_to_json(meta.role_id) as assignment;
create type meta.row_id as (schema_name text,relation_name text,pk_column_names text[],pk_values text[]);
create function meta.row_id(schema_name text,relation_name text,pk_column_names text[],pk_values text[]) returns meta.row_id as $_$ select row(schema_name,relation_name,pk_column_names,pk_values)::meta.row_id $_$ immutable language sql;
create function meta.meta_id(row_id meta.row_id) returns meta.meta_id as $_$ select meta.meta_id('row'); $_$ immutable language sql;
create function meta.row_id(value jsonb) returns meta.row_id as $_$select meta.row_id((value->>'schema_name')::text, (value->>'relation_name')::text, (select array_agg(value) from jsonb_array_elements_text(value->'pk_column_names')), (select array_agg(value) from jsonb_array_elements_text(value->'pk_values'))) $_$ immutable language sql;
create function meta.eq(leftarg meta.row_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).relation_name)::text = (rightarg)->>'relation_name' and to_jsonb((leftarg).pk_column_names) = rightarg->'pk_column_names' and to_jsonb((leftarg).pk_values) = rightarg->'pk_values'$_$ immutable language sql;
create operator meta.= (leftarg = meta.row_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.row_id) with function meta.row_id(jsonb) as assignment;
create function meta.row_id_to_jsonb(value meta.row_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.row_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and leftarg->'pk_column_names' = to_jsonb((rightarg).pk_column_names) and leftarg->'pk_values' = to_jsonb((rightarg).pk_values)$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.row_id, procedure = meta.eq);
create cast (meta.row_id as jsonb) with function meta.row_id_to_jsonb(meta.row_id) as assignment;
create function meta.row_id(value json) returns meta.row_id as $_$select meta.row_id((value->>'schema_name')::text, (value->>'relation_name')::text, (select array_agg(value) from json_array_elements_text(value->'pk_column_names')), (select array_agg(value) from json_array_elements_text(value->'pk_values'))) $_$ immutable language sql;
create function meta.eq(leftarg meta.row_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).relation_name)::text = ((rightarg)->>'relation_name')::text and to_json((leftarg).pk_column_names)::text = (rightarg->'pk_column_names')::text and to_json((leftarg).pk_values)::text = (rightarg->'pk_values')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.row_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.row_id) with function meta.row_id(json) as assignment;
create function meta.row_id_to_json(value meta.row_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.row_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg->'pk_column_names')::text = (to_json((rightarg).pk_column_names))::text and (leftarg->'pk_values')::text = (to_json((rightarg).pk_values))::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.row_id, procedure = meta.eq);
create cast (meta.row_id as json) with function meta.row_id_to_json(meta.row_id) as assignment;
create type meta.schema_id as (name text);
create function meta.schema_id(name text) returns meta.schema_id as $_$ select row(name)::meta.schema_id $_$ immutable language sql;
create function meta.meta_id(schema_id meta.schema_id) returns meta.meta_id as $_$ select meta.meta_id('schema'); $_$ immutable language sql;
create function meta.schema_id(value jsonb) returns meta.schema_id as $_$select meta.schema_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.schema_id, rightarg jsonb) returns boolean as $_$select ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.schema_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.schema_id) with function meta.schema_id(jsonb) as assignment;
create function meta.schema_id_to_jsonb(value meta.schema_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.schema_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.schema_id, procedure = meta.eq);
create cast (meta.schema_id as jsonb) with function meta.schema_id_to_jsonb(meta.schema_id) as assignment;
create function meta.schema_id(value json) returns meta.schema_id as $_$select meta.schema_id((value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.schema_id, rightarg json) returns boolean as $_$select ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.schema_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.schema_id) with function meta.schema_id(json) as assignment;
create function meta.schema_id_to_json(value meta.schema_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.schema_id) returns boolean as $_$select (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.schema_id, procedure = meta.eq);
create cast (meta.schema_id as json) with function meta.schema_id_to_json(meta.schema_id) as assignment;
create type meta.sequence_id as (schema_name text,name text);
create function meta.sequence_id(schema_name text,name text) returns meta.sequence_id as $_$ select row(schema_name,name)::meta.sequence_id $_$ immutable language sql;
create function meta.meta_id(sequence_id meta.sequence_id) returns meta.meta_id as $_$ select meta.meta_id('sequence'); $_$ immutable language sql;
create function meta.sequence_id(value jsonb) returns meta.sequence_id as $_$select meta.sequence_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.sequence_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.sequence_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.sequence_id) with function meta.sequence_id(jsonb) as assignment;
create function meta.sequence_id_to_jsonb(value meta.sequence_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.sequence_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.sequence_id, procedure = meta.eq);
create cast (meta.sequence_id as jsonb) with function meta.sequence_id_to_jsonb(meta.sequence_id) as assignment;
create function meta.sequence_id(value json) returns meta.sequence_id as $_$select meta.sequence_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.sequence_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.sequence_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.sequence_id) with function meta.sequence_id(json) as assignment;
create function meta.sequence_id_to_json(value meta.sequence_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.sequence_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.sequence_id, procedure = meta.eq);
create cast (meta.sequence_id as json) with function meta.sequence_id_to_json(meta.sequence_id) as assignment;
create type meta.table_id as (schema_name text,name text);
create function meta.table_id(schema_name text,name text) returns meta.table_id as $_$ select row(schema_name,name)::meta.table_id $_$ immutable language sql;
create function meta.meta_id(table_id meta.table_id) returns meta.meta_id as $_$ select meta.meta_id('table'); $_$ immutable language sql;
create function meta.table_id(value jsonb) returns meta.table_id as $_$select meta.table_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.table_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.table_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.table_id) with function meta.table_id(jsonb) as assignment;
create function meta.table_id_to_jsonb(value meta.table_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.table_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.table_id, procedure = meta.eq);
create cast (meta.table_id as jsonb) with function meta.table_id_to_jsonb(meta.table_id) as assignment;
create function meta.table_id(value json) returns meta.table_id as $_$select meta.table_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.table_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.table_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.table_id) with function meta.table_id(json) as assignment;
create function meta.table_id_to_json(value meta.table_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.table_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.table_id, procedure = meta.eq);
create cast (meta.table_id as json) with function meta.table_id_to_json(meta.table_id) as assignment;
create type meta.table_privilege_id as (schema_name text,relation_name text,role text,type text);
create function meta.table_privilege_id(schema_name text,relation_name text,role text,type text) returns meta.table_privilege_id as $_$ select row(schema_name,relation_name,role,type)::meta.table_privilege_id $_$ immutable language sql;
create function meta.meta_id(table_privilege_id meta.table_privilege_id) returns meta.meta_id as $_$ select meta.meta_id('table_privilege'); $_$ immutable language sql;
create function meta.table_privilege_id(value jsonb) returns meta.table_privilege_id as $_$select meta.table_privilege_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'role')::text, (value->>'type')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.table_privilege_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).relation_name)::text = (rightarg)->>'relation_name' and ((leftarg).role)::text = (rightarg)->>'role' and ((leftarg).type)::text = (rightarg)->>'type'$_$ immutable language sql;
create operator meta.= (leftarg = meta.table_privilege_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.table_privilege_id) with function meta.table_privilege_id(jsonb) as assignment;
create function meta.table_privilege_id_to_jsonb(value meta.table_privilege_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.table_privilege_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'role' = ((rightarg).role)::text and (leftarg)->>'type' = ((rightarg).type)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.table_privilege_id, procedure = meta.eq);
create cast (meta.table_privilege_id as jsonb) with function meta.table_privilege_id_to_jsonb(meta.table_privilege_id) as assignment;
create function meta.table_privilege_id(value json) returns meta.table_privilege_id as $_$select meta.table_privilege_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'role')::text, (value->>'type')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.table_privilege_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).relation_name)::text = ((rightarg)->>'relation_name')::text and ((leftarg).role)::text = ((rightarg)->>'role')::text and ((leftarg).type)::text = ((rightarg)->>'type')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.table_privilege_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.table_privilege_id) with function meta.table_privilege_id(json) as assignment;
create function meta.table_privilege_id_to_json(value meta.table_privilege_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.table_privilege_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'role' = ((rightarg).role)::text and (leftarg)->>'type' = ((rightarg).type)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.table_privilege_id, procedure = meta.eq);
create cast (meta.table_privilege_id as json) with function meta.table_privilege_id_to_json(meta.table_privilege_id) as assignment;
create type meta.trigger_id as (schema_name text,relation_name text,name text);
create function meta.trigger_id(schema_name text,relation_name text,name text) returns meta.trigger_id as $_$ select row(schema_name,relation_name,name)::meta.trigger_id $_$ immutable language sql;
create function meta.meta_id(trigger_id meta.trigger_id) returns meta.meta_id as $_$ select meta.meta_id('trigger'); $_$ immutable language sql;
create function meta.trigger_id(value jsonb) returns meta.trigger_id as $_$select meta.trigger_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.trigger_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).relation_name)::text = (rightarg)->>'relation_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.trigger_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.trigger_id) with function meta.trigger_id(jsonb) as assignment;
create function meta.trigger_id_to_jsonb(value meta.trigger_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.trigger_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.trigger_id, procedure = meta.eq);
create cast (meta.trigger_id as jsonb) with function meta.trigger_id_to_jsonb(meta.trigger_id) as assignment;
create function meta.trigger_id(value json) returns meta.trigger_id as $_$select meta.trigger_id((value->>'schema_name')::text, (value->>'relation_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.trigger_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).relation_name)::text = ((rightarg)->>'relation_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.trigger_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.trigger_id) with function meta.trigger_id(json) as assignment;
create function meta.trigger_id_to_json(value meta.trigger_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.trigger_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'relation_name' = ((rightarg).relation_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.trigger_id, procedure = meta.eq);
create cast (meta.trigger_id as json) with function meta.trigger_id_to_json(meta.trigger_id) as assignment;
create type meta.type_id as (schema_name text,name text);
create function meta.type_id(schema_name text,name text) returns meta.type_id as $_$ select row(schema_name,name)::meta.type_id $_$ immutable language sql;
create function meta.meta_id(type_id meta.type_id) returns meta.meta_id as $_$ select meta.meta_id('type'); $_$ immutable language sql;
create function meta.type_id(value jsonb) returns meta.type_id as $_$select meta.type_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.type_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.type_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.type_id) with function meta.type_id(jsonb) as assignment;
create function meta.type_id_to_jsonb(value meta.type_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.type_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.type_id, procedure = meta.eq);
create cast (meta.type_id as jsonb) with function meta.type_id_to_jsonb(meta.type_id) as assignment;
create function meta.type_id(value json) returns meta.type_id as $_$select meta.type_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.type_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.type_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.type_id) with function meta.type_id(json) as assignment;
create function meta.type_id_to_json(value meta.type_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.type_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.type_id, procedure = meta.eq);
create cast (meta.type_id as json) with function meta.type_id_to_json(meta.type_id) as assignment;
create type meta.view_id as (schema_name text,name text);
create function meta.view_id(schema_name text,name text) returns meta.view_id as $_$ select row(schema_name,name)::meta.view_id $_$ immutable language sql;
create function meta.meta_id(view_id meta.view_id) returns meta.meta_id as $_$ select meta.meta_id('view'); $_$ immutable language sql;
create function meta.view_id(value jsonb) returns meta.view_id as $_$select meta.view_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.view_id, rightarg jsonb) returns boolean as $_$select ((leftarg).schema_name)::text = (rightarg)->>'schema_name' and ((leftarg).name)::text = (rightarg)->>'name'$_$ immutable language sql;
create operator meta.= (leftarg = meta.view_id, rightarg = jsonb, procedure = meta.eq);
create cast (jsonb as meta.view_id) with function meta.view_id(jsonb) as assignment;
create function meta.view_id_to_jsonb(value meta.view_id) returns jsonb as $_$select to_jsonb(value)$_$ immutable language sql;
create function meta.eq(leftarg jsonb, rightarg meta.view_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = jsonb, rightarg = meta.view_id, procedure = meta.eq);
create cast (meta.view_id as jsonb) with function meta.view_id_to_jsonb(meta.view_id) as assignment;
create function meta.view_id(value json) returns meta.view_id as $_$select meta.view_id((value->>'schema_name')::text, (value->>'name')::text) $_$ immutable language sql;
create function meta.eq(leftarg meta.view_id, rightarg json) returns boolean as $_$select ((leftarg).schema_name)::text = ((rightarg)->>'schema_name')::text and ((leftarg).name)::text = ((rightarg)->>'name')::text$_$ immutable language sql;
create operator meta.= (leftarg = meta.view_id, rightarg = json, procedure = meta.eq);
create cast (json as meta.view_id) with function meta.view_id(json) as assignment;
create function meta.view_id_to_json(value meta.view_id) returns json as $_$select to_json(value)$_$ immutable language sql;
create function meta.eq(leftarg json, rightarg meta.view_id) returns boolean as $_$select (leftarg)->>'schema_name' = ((rightarg).schema_name)::text and (leftarg)->>'name' = ((rightarg).name)::text$_$ immutable language sql;
create operator meta.= (leftarg = json, rightarg = meta.view_id, procedure = meta.eq);
create cast (meta.view_id as json) with function meta.view_id_to_json(meta.view_id) as assignment;
-- (494 rows)
create function meta.column_id_to_schema_id(column_id meta.column_id) returns meta.schema_id as $_$select meta.schema_id((column_id).schema_name) $_$ immutable language sql;
create cast (meta.column_id as meta.schema_id) with function meta.column_id_to_schema_id(meta.column_id) as assignment;
create function meta.constraint_id_to_schema_id(constraint_id meta.constraint_id) returns meta.schema_id as $_$select meta.schema_id((constraint_id).schema_name) $_$ immutable language sql;
create cast (meta.constraint_id as meta.schema_id) with function meta.constraint_id_to_schema_id(meta.constraint_id) as assignment;
create function meta.constraint_check_id_to_schema_id(constraint_check_id meta.constraint_check_id) returns meta.schema_id as $_$select meta.schema_id((constraint_check_id).schema_name) $_$ immutable language sql;
create cast (meta.constraint_check_id as meta.schema_id) with function meta.constraint_check_id_to_schema_id(meta.constraint_check_id) as assignment;
create function meta.constraint_unique_id_to_schema_id(constraint_unique_id meta.constraint_unique_id) returns meta.schema_id as $_$select meta.schema_id((constraint_unique_id).schema_name) $_$ immutable language sql;
create cast (meta.constraint_unique_id as meta.schema_id) with function meta.constraint_unique_id_to_schema_id(meta.constraint_unique_id) as assignment;
create function meta.field_id_to_schema_id(field_id meta.field_id) returns meta.schema_id as $_$select meta.schema_id((field_id).schema_name) $_$ immutable language sql;
create cast (meta.field_id as meta.schema_id) with function meta.field_id_to_schema_id(meta.field_id) as assignment;
create function meta.foreign_column_id_to_schema_id(foreign_column_id meta.foreign_column_id) returns meta.schema_id as $_$select meta.schema_id((foreign_column_id).schema_name) $_$ immutable language sql;
create cast (meta.foreign_column_id as meta.schema_id) with function meta.foreign_column_id_to_schema_id(meta.foreign_column_id) as assignment;
create function meta.foreign_key_id_to_schema_id(foreign_key_id meta.foreign_key_id) returns meta.schema_id as $_$select meta.schema_id((foreign_key_id).schema_name) $_$ immutable language sql;
create cast (meta.foreign_key_id as meta.schema_id) with function meta.foreign_key_id_to_schema_id(meta.foreign_key_id) as assignment;
create function meta.foreign_table_id_to_schema_id(foreign_table_id meta.foreign_table_id) returns meta.schema_id as $_$select meta.schema_id((foreign_table_id).schema_name) $_$ immutable language sql;
create cast (meta.foreign_table_id as meta.schema_id) with function meta.foreign_table_id_to_schema_id(meta.foreign_table_id) as assignment;
create function meta.function_id_to_schema_id(function_id meta.function_id) returns meta.schema_id as $_$select meta.schema_id((function_id).schema_name) $_$ immutable language sql;
create cast (meta.function_id as meta.schema_id) with function meta.function_id_to_schema_id(meta.function_id) as assignment;
create function meta.operator_id_to_schema_id(operator_id meta.operator_id) returns meta.schema_id as $_$select meta.schema_id((operator_id).schema_name) $_$ immutable language sql;
create cast (meta.operator_id as meta.schema_id) with function meta.operator_id_to_schema_id(meta.operator_id) as assignment;
create function meta.policy_id_to_schema_id(policy_id meta.policy_id) returns meta.schema_id as $_$select meta.schema_id((policy_id).schema_name) $_$ immutable language sql;
create cast (meta.policy_id as meta.schema_id) with function meta.policy_id_to_schema_id(meta.policy_id) as assignment;
create function meta.relation_id_to_schema_id(relation_id meta.relation_id) returns meta.schema_id as $_$select meta.schema_id((relation_id).schema_name) $_$ immutable language sql;
create cast (meta.relation_id as meta.schema_id) with function meta.relation_id_to_schema_id(meta.relation_id) as assignment;
create function meta.row_id_to_schema_id(row_id meta.row_id) returns meta.schema_id as $_$select meta.schema_id((row_id).schema_name) $_$ immutable language sql;
create cast (meta.row_id as meta.schema_id) with function meta.row_id_to_schema_id(meta.row_id) as assignment;
create function meta.sequence_id_to_schema_id(sequence_id meta.sequence_id) returns meta.schema_id as $_$select meta.schema_id((sequence_id).schema_name) $_$ immutable language sql;
create cast (meta.sequence_id as meta.schema_id) with function meta.sequence_id_to_schema_id(meta.sequence_id) as assignment;
create function meta.table_id_to_schema_id(table_id meta.table_id) returns meta.schema_id as $_$select meta.schema_id((table_id).schema_name) $_$ immutable language sql;
create cast (meta.table_id as meta.schema_id) with function meta.table_id_to_schema_id(meta.table_id) as assignment;
create function meta.table_privilege_id_to_schema_id(table_privilege_id meta.table_privilege_id) returns meta.schema_id as $_$select meta.schema_id((table_privilege_id).schema_name) $_$ immutable language sql;
create cast (meta.table_privilege_id as meta.schema_id) with function meta.table_privilege_id_to_schema_id(meta.table_privilege_id) as assignment;
create function meta.trigger_id_to_schema_id(trigger_id meta.trigger_id) returns meta.schema_id as $_$select meta.schema_id((trigger_id).schema_name) $_$ immutable language sql;
create cast (meta.trigger_id as meta.schema_id) with function meta.trigger_id_to_schema_id(meta.trigger_id) as assignment;
create function meta.type_id_to_schema_id(type_id meta.type_id) returns meta.schema_id as $_$select meta.schema_id((type_id).schema_name) $_$ immutable language sql;
create cast (meta.type_id as meta.schema_id) with function meta.type_id_to_schema_id(meta.type_id) as assignment;
create function meta.view_id_to_schema_id(view_id meta.view_id) returns meta.schema_id as $_$select meta.schema_id((view_id).schema_name) $_$ immutable language sql;
create cast (meta.view_id as meta.schema_id) with function meta.view_id_to_schema_id(meta.view_id) as assignment;
-- (38 rows)
create function meta.column_id_to_relation_id(column_id meta.column_id) returns meta.relation_id as $_$select meta.relation_id((column_id).schema_name, (column_id).relation_name) $_$ immutable language sql;
create cast (meta.column_id as meta.relation_id) with function meta.column_id_to_relation_id(meta.column_id) as assignment;
create function meta.constraint_id_to_relation_id(constraint_id meta.constraint_id) returns meta.relation_id as $_$select meta.relation_id((constraint_id).schema_name, (constraint_id).relation_name) $_$ immutable language sql;
create cast (meta.constraint_id as meta.relation_id) with function meta.constraint_id_to_relation_id(meta.constraint_id) as assignment;
create function meta.field_id_to_relation_id(field_id meta.field_id) returns meta.relation_id as $_$select meta.relation_id((field_id).schema_name, (field_id).relation_name) $_$ immutable language sql;
create cast (meta.field_id as meta.relation_id) with function meta.field_id_to_relation_id(meta.field_id) as assignment;
create function meta.foreign_key_id_to_relation_id(foreign_key_id meta.foreign_key_id) returns meta.relation_id as $_$select meta.relation_id((foreign_key_id).schema_name, (foreign_key_id).relation_name) $_$ immutable language sql;
create cast (meta.foreign_key_id as meta.relation_id) with function meta.foreign_key_id_to_relation_id(meta.foreign_key_id) as assignment;
create function meta.policy_id_to_relation_id(policy_id meta.policy_id) returns meta.relation_id as $_$select meta.relation_id((policy_id).schema_name, (policy_id).relation_name) $_$ immutable language sql;
create cast (meta.policy_id as meta.relation_id) with function meta.policy_id_to_relation_id(meta.policy_id) as assignment;
create function meta.row_id_to_relation_id(row_id meta.row_id) returns meta.relation_id as $_$select meta.relation_id((row_id).schema_name, (row_id).relation_name) $_$ immutable language sql;
create cast (meta.row_id as meta.relation_id) with function meta.row_id_to_relation_id(meta.row_id) as assignment;
create function meta.table_privilege_id_to_relation_id(table_privilege_id meta.table_privilege_id) returns meta.relation_id as $_$select meta.relation_id((table_privilege_id).schema_name, (table_privilege_id).relation_name) $_$ immutable language sql;
create cast (meta.table_privilege_id as meta.relation_id) with function meta.table_privilege_id_to_relation_id(meta.table_privilege_id) as assignment;
create function meta.trigger_id_to_relation_id(trigger_id meta.trigger_id) returns meta.relation_id as $_$select meta.relation_id((trigger_id).schema_name, (trigger_id).relation_name) $_$ immutable language sql;
create cast (meta.trigger_id as meta.relation_id) with function meta.trigger_id_to_relation_id(meta.trigger_id) as assignment;
-- (16 rows)
create function meta.field_id_to_column_id(field_id meta.field_id) returns meta.column_id as $_$select meta.column_id((field_id).schema_name, (field_id).relation_name, (field_id).column_name) $_$ immutable language sql;
create cast (meta.field_id as meta.column_id) with function meta.field_id_to_column_id(meta.field_id) as assignment;
-- (2 rows)