-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
Copy pathpg_catalog
5479 lines (5113 loc) · 421 KB
/
pg_catalog
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
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# LogicTest: local !3node-tenant(52567)
statement ok
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false
# Verify pg_catalog database handles mutation statements correctly.
query error database "pg_catalog" does not exist
ALTER DATABASE pg_catalog RENAME TO not_pg_catalog
statement error schema cannot be modified: "pg_catalog"
CREATE TABLE pg_catalog.t (x INT)
query error database "pg_catalog" does not exist
DROP DATABASE pg_catalog
query TTTTIT
SHOW TABLES FROM pg_catalog
----
pg_catalog pg_aggregate table NULL NULL NULL
pg_catalog pg_am table NULL NULL NULL
pg_catalog pg_amop table NULL NULL NULL
pg_catalog pg_amproc table NULL NULL NULL
pg_catalog pg_attrdef table NULL NULL NULL
pg_catalog pg_attribute table NULL NULL NULL
pg_catalog pg_auth_members table NULL NULL NULL
pg_catalog pg_authid table NULL NULL NULL
pg_catalog pg_available_extension_versions table NULL NULL NULL
pg_catalog pg_available_extensions table NULL NULL NULL
pg_catalog pg_cast table NULL NULL NULL
pg_catalog pg_class table NULL NULL NULL
pg_catalog pg_collation table NULL NULL NULL
pg_catalog pg_config table NULL NULL NULL
pg_catalog pg_constraint table NULL NULL NULL
pg_catalog pg_conversion table NULL NULL NULL
pg_catalog pg_cursors table NULL NULL NULL
pg_catalog pg_database table NULL NULL NULL
pg_catalog pg_db_role_setting table NULL NULL NULL
pg_catalog pg_default_acl table NULL NULL NULL
pg_catalog pg_depend table NULL NULL NULL
pg_catalog pg_description table NULL NULL NULL
pg_catalog pg_enum table NULL NULL NULL
pg_catalog pg_event_trigger table NULL NULL NULL
pg_catalog pg_extension table NULL NULL NULL
pg_catalog pg_file_settings table NULL NULL NULL
pg_catalog pg_foreign_data_wrapper table NULL NULL NULL
pg_catalog pg_foreign_server table NULL NULL NULL
pg_catalog pg_foreign_table table NULL NULL NULL
pg_catalog pg_group table NULL NULL NULL
pg_catalog pg_hba_file_rules table NULL NULL NULL
pg_catalog pg_index table NULL NULL NULL
pg_catalog pg_indexes table NULL NULL NULL
pg_catalog pg_inherits table NULL NULL NULL
pg_catalog pg_init_privs table NULL NULL NULL
pg_catalog pg_language table NULL NULL NULL
pg_catalog pg_largeobject table NULL NULL NULL
pg_catalog pg_largeobject_metadata table NULL NULL NULL
pg_catalog pg_locks table NULL NULL NULL
pg_catalog pg_matviews table NULL NULL NULL
pg_catalog pg_namespace table NULL NULL NULL
pg_catalog pg_opclass table NULL NULL NULL
pg_catalog pg_operator table NULL NULL NULL
pg_catalog pg_opfamily table NULL NULL NULL
pg_catalog pg_partitioned_table table NULL NULL NULL
pg_catalog pg_policies table NULL NULL NULL
pg_catalog pg_policy table NULL NULL NULL
pg_catalog pg_prepared_statements table NULL NULL NULL
pg_catalog pg_prepared_xacts table NULL NULL NULL
pg_catalog pg_proc table NULL NULL NULL
pg_catalog pg_publication table NULL NULL NULL
pg_catalog pg_publication_rel table NULL NULL NULL
pg_catalog pg_publication_tables table NULL NULL NULL
pg_catalog pg_range table NULL NULL NULL
pg_catalog pg_replication_origin table NULL NULL NULL
pg_catalog pg_replication_origin_status table NULL NULL NULL
pg_catalog pg_replication_slots table NULL NULL NULL
pg_catalog pg_rewrite table NULL NULL NULL
pg_catalog pg_roles table NULL NULL NULL
pg_catalog pg_rules table NULL NULL NULL
pg_catalog pg_seclabel table NULL NULL NULL
pg_catalog pg_seclabels table NULL NULL NULL
pg_catalog pg_sequence table NULL NULL NULL
pg_catalog pg_sequences table NULL NULL NULL
pg_catalog pg_settings table NULL NULL NULL
pg_catalog pg_shadow table NULL NULL NULL
pg_catalog pg_shdepend table NULL NULL NULL
pg_catalog pg_shdescription table NULL NULL NULL
pg_catalog pg_shmem_allocations table NULL NULL NULL
pg_catalog pg_shseclabel table NULL NULL NULL
pg_catalog pg_stat_activity table NULL NULL NULL
pg_catalog pg_stat_all_indexes table NULL NULL NULL
pg_catalog pg_stat_all_tables table NULL NULL NULL
pg_catalog pg_stat_archiver table NULL NULL NULL
pg_catalog pg_stat_bgwriter table NULL NULL NULL
pg_catalog pg_stat_database table NULL NULL NULL
pg_catalog pg_stat_database_conflicts table NULL NULL NULL
pg_catalog pg_stat_gssapi table NULL NULL NULL
pg_catalog pg_stat_progress_analyze table NULL NULL NULL
pg_catalog pg_stat_progress_basebackup table NULL NULL NULL
pg_catalog pg_stat_progress_cluster table NULL NULL NULL
pg_catalog pg_stat_progress_create_index table NULL NULL NULL
pg_catalog pg_stat_progress_vacuum table NULL NULL NULL
pg_catalog pg_stat_replication table NULL NULL NULL
pg_catalog pg_stat_slru table NULL NULL NULL
pg_catalog pg_stat_ssl table NULL NULL NULL
pg_catalog pg_stat_subscription table NULL NULL NULL
pg_catalog pg_stat_sys_indexes table NULL NULL NULL
pg_catalog pg_stat_sys_tables table NULL NULL NULL
pg_catalog pg_stat_user_functions table NULL NULL NULL
pg_catalog pg_stat_user_indexes table NULL NULL NULL
pg_catalog pg_stat_user_tables table NULL NULL NULL
pg_catalog pg_stat_wal_receiver table NULL NULL NULL
pg_catalog pg_stat_xact_all_tables table NULL NULL NULL
pg_catalog pg_stat_xact_sys_tables table NULL NULL NULL
pg_catalog pg_stat_xact_user_functions table NULL NULL NULL
pg_catalog pg_stat_xact_user_tables table NULL NULL NULL
pg_catalog pg_statio_all_indexes table NULL NULL NULL
pg_catalog pg_statio_all_sequences table NULL NULL NULL
pg_catalog pg_statio_all_tables table NULL NULL NULL
pg_catalog pg_statio_sys_indexes table NULL NULL NULL
pg_catalog pg_statio_sys_sequences table NULL NULL NULL
pg_catalog pg_statio_sys_tables table NULL NULL NULL
pg_catalog pg_statio_user_indexes table NULL NULL NULL
pg_catalog pg_statio_user_sequences table NULL NULL NULL
pg_catalog pg_statio_user_tables table NULL NULL NULL
pg_catalog pg_statistic table NULL NULL NULL
pg_catalog pg_statistic_ext table NULL NULL NULL
pg_catalog pg_statistic_ext_data table NULL NULL NULL
pg_catalog pg_stats table NULL NULL NULL
pg_catalog pg_stats_ext table NULL NULL NULL
pg_catalog pg_subscription table NULL NULL NULL
pg_catalog pg_subscription_rel table NULL NULL NULL
pg_catalog pg_tables table NULL NULL NULL
pg_catalog pg_tablespace table NULL NULL NULL
pg_catalog pg_timezone_abbrevs table NULL NULL NULL
pg_catalog pg_timezone_names table NULL NULL NULL
pg_catalog pg_transform table NULL NULL NULL
pg_catalog pg_trigger table NULL NULL NULL
pg_catalog pg_ts_config table NULL NULL NULL
pg_catalog pg_ts_config_map table NULL NULL NULL
pg_catalog pg_ts_dict table NULL NULL NULL
pg_catalog pg_ts_parser table NULL NULL NULL
pg_catalog pg_ts_template table NULL NULL NULL
pg_catalog pg_type table NULL NULL NULL
pg_catalog pg_user table NULL NULL NULL
pg_catalog pg_user_mapping table NULL NULL NULL
pg_catalog pg_user_mappings table NULL NULL NULL
pg_catalog pg_views table NULL NULL NULL
# Verify "pg_catalog" is a regular db name
statement ok
CREATE DATABASE other_db
statement ok
ALTER DATABASE other_db RENAME TO pg_catalog
statement error database "pg_catalog" already exists
CREATE DATABASE pg_catalog
statement ok
DROP DATABASE pg_catalog
# the following query checks that the planDataSource instantiated from
# a virtual table in the FROM clause is properly deallocated even when
# query preparation causes an error. #9853
query error unknown function
SELECT * FROM pg_catalog.pg_class c WHERE nonexistent_function()
# Verify pg_catalog handles reflection correctly.
query TTTTIT
SHOW TABLES FROM test.pg_catalog
----
pg_catalog pg_aggregate table NULL NULL NULL
pg_catalog pg_am table NULL NULL NULL
pg_catalog pg_amop table NULL NULL NULL
pg_catalog pg_amproc table NULL NULL NULL
pg_catalog pg_attrdef table NULL NULL NULL
pg_catalog pg_attribute table NULL NULL NULL
pg_catalog pg_auth_members table NULL NULL NULL
pg_catalog pg_authid table NULL NULL NULL
pg_catalog pg_available_extension_versions table NULL NULL NULL
pg_catalog pg_available_extensions table NULL NULL NULL
pg_catalog pg_cast table NULL NULL NULL
pg_catalog pg_class table NULL NULL NULL
pg_catalog pg_collation table NULL NULL NULL
pg_catalog pg_config table NULL NULL NULL
pg_catalog pg_constraint table NULL NULL NULL
pg_catalog pg_conversion table NULL NULL NULL
pg_catalog pg_cursors table NULL NULL NULL
pg_catalog pg_database table NULL NULL NULL
pg_catalog pg_db_role_setting table NULL NULL NULL
pg_catalog pg_default_acl table NULL NULL NULL
pg_catalog pg_depend table NULL NULL NULL
pg_catalog pg_description table NULL NULL NULL
pg_catalog pg_enum table NULL NULL NULL
pg_catalog pg_event_trigger table NULL NULL NULL
pg_catalog pg_extension table NULL NULL NULL
pg_catalog pg_file_settings table NULL NULL NULL
pg_catalog pg_foreign_data_wrapper table NULL NULL NULL
pg_catalog pg_foreign_server table NULL NULL NULL
pg_catalog pg_foreign_table table NULL NULL NULL
pg_catalog pg_group table NULL NULL NULL
pg_catalog pg_hba_file_rules table NULL NULL NULL
pg_catalog pg_index table NULL NULL NULL
pg_catalog pg_indexes table NULL NULL NULL
pg_catalog pg_inherits table NULL NULL NULL
pg_catalog pg_init_privs table NULL NULL NULL
pg_catalog pg_language table NULL NULL NULL
pg_catalog pg_largeobject table NULL NULL NULL
pg_catalog pg_largeobject_metadata table NULL NULL NULL
pg_catalog pg_locks table NULL NULL NULL
pg_catalog pg_matviews table NULL NULL NULL
pg_catalog pg_namespace table NULL NULL NULL
pg_catalog pg_opclass table NULL NULL NULL
pg_catalog pg_operator table NULL NULL NULL
pg_catalog pg_opfamily table NULL NULL NULL
pg_catalog pg_partitioned_table table NULL NULL NULL
pg_catalog pg_policies table NULL NULL NULL
pg_catalog pg_policy table NULL NULL NULL
pg_catalog pg_prepared_statements table NULL NULL NULL
pg_catalog pg_prepared_xacts table NULL NULL NULL
pg_catalog pg_proc table NULL NULL NULL
pg_catalog pg_publication table NULL NULL NULL
pg_catalog pg_publication_rel table NULL NULL NULL
pg_catalog pg_publication_tables table NULL NULL NULL
pg_catalog pg_range table NULL NULL NULL
pg_catalog pg_replication_origin table NULL NULL NULL
pg_catalog pg_replication_origin_status table NULL NULL NULL
pg_catalog pg_replication_slots table NULL NULL NULL
pg_catalog pg_rewrite table NULL NULL NULL
pg_catalog pg_roles table NULL NULL NULL
pg_catalog pg_rules table NULL NULL NULL
pg_catalog pg_seclabel table NULL NULL NULL
pg_catalog pg_seclabels table NULL NULL NULL
pg_catalog pg_sequence table NULL NULL NULL
pg_catalog pg_sequences table NULL NULL NULL
pg_catalog pg_settings table NULL NULL NULL
pg_catalog pg_shadow table NULL NULL NULL
pg_catalog pg_shdepend table NULL NULL NULL
pg_catalog pg_shdescription table NULL NULL NULL
pg_catalog pg_shmem_allocations table NULL NULL NULL
pg_catalog pg_shseclabel table NULL NULL NULL
pg_catalog pg_stat_activity table NULL NULL NULL
pg_catalog pg_stat_all_indexes table NULL NULL NULL
pg_catalog pg_stat_all_tables table NULL NULL NULL
pg_catalog pg_stat_archiver table NULL NULL NULL
pg_catalog pg_stat_bgwriter table NULL NULL NULL
pg_catalog pg_stat_database table NULL NULL NULL
pg_catalog pg_stat_database_conflicts table NULL NULL NULL
pg_catalog pg_stat_gssapi table NULL NULL NULL
pg_catalog pg_stat_progress_analyze table NULL NULL NULL
pg_catalog pg_stat_progress_basebackup table NULL NULL NULL
pg_catalog pg_stat_progress_cluster table NULL NULL NULL
pg_catalog pg_stat_progress_create_index table NULL NULL NULL
pg_catalog pg_stat_progress_vacuum table NULL NULL NULL
pg_catalog pg_stat_replication table NULL NULL NULL
pg_catalog pg_stat_slru table NULL NULL NULL
pg_catalog pg_stat_ssl table NULL NULL NULL
pg_catalog pg_stat_subscription table NULL NULL NULL
pg_catalog pg_stat_sys_indexes table NULL NULL NULL
pg_catalog pg_stat_sys_tables table NULL NULL NULL
pg_catalog pg_stat_user_functions table NULL NULL NULL
pg_catalog pg_stat_user_indexes table NULL NULL NULL
pg_catalog pg_stat_user_tables table NULL NULL NULL
pg_catalog pg_stat_wal_receiver table NULL NULL NULL
pg_catalog pg_stat_xact_all_tables table NULL NULL NULL
pg_catalog pg_stat_xact_sys_tables table NULL NULL NULL
pg_catalog pg_stat_xact_user_functions table NULL NULL NULL
pg_catalog pg_stat_xact_user_tables table NULL NULL NULL
pg_catalog pg_statio_all_indexes table NULL NULL NULL
pg_catalog pg_statio_all_sequences table NULL NULL NULL
pg_catalog pg_statio_all_tables table NULL NULL NULL
pg_catalog pg_statio_sys_indexes table NULL NULL NULL
pg_catalog pg_statio_sys_sequences table NULL NULL NULL
pg_catalog pg_statio_sys_tables table NULL NULL NULL
pg_catalog pg_statio_user_indexes table NULL NULL NULL
pg_catalog pg_statio_user_sequences table NULL NULL NULL
pg_catalog pg_statio_user_tables table NULL NULL NULL
pg_catalog pg_statistic table NULL NULL NULL
pg_catalog pg_statistic_ext table NULL NULL NULL
pg_catalog pg_statistic_ext_data table NULL NULL NULL
pg_catalog pg_stats table NULL NULL NULL
pg_catalog pg_stats_ext table NULL NULL NULL
pg_catalog pg_subscription table NULL NULL NULL
pg_catalog pg_subscription_rel table NULL NULL NULL
pg_catalog pg_tables table NULL NULL NULL
pg_catalog pg_tablespace table NULL NULL NULL
pg_catalog pg_timezone_abbrevs table NULL NULL NULL
pg_catalog pg_timezone_names table NULL NULL NULL
pg_catalog pg_transform table NULL NULL NULL
pg_catalog pg_trigger table NULL NULL NULL
pg_catalog pg_ts_config table NULL NULL NULL
pg_catalog pg_ts_config_map table NULL NULL NULL
pg_catalog pg_ts_dict table NULL NULL NULL
pg_catalog pg_ts_parser table NULL NULL NULL
pg_catalog pg_ts_template table NULL NULL NULL
pg_catalog pg_type table NULL NULL NULL
pg_catalog pg_user table NULL NULL NULL
pg_catalog pg_user_mapping table NULL NULL NULL
pg_catalog pg_user_mappings table NULL NULL NULL
pg_catalog pg_views table NULL NULL NULL
query TT colnames
SHOW CREATE TABLE pg_catalog.pg_namespace
----
table_name create_statement
pg_catalog.pg_namespace CREATE TABLE pg_catalog.pg_namespace (
oid OID NULL,
nspname NAME NOT NULL,
nspowner OID NULL,
nspacl STRING[] NULL
)
query TTBTTTB colnames
SHOW COLUMNS FROM pg_catalog.pg_namespace
----
column_name data_type is_nullable column_default generation_expression indices is_hidden
oid OID true NULL · {} false
nspname NAME false NULL · {} false
nspowner OID true NULL · {} false
nspacl STRING[] true NULL · {} false
query TTBITTBB colnames
SHOW INDEXES FROM pg_catalog.pg_namespace
----
table_name index_name non_unique seq_in_index column_name direction storing implicit
query TTTTB colnames
SHOW CONSTRAINTS FROM pg_catalog.pg_namespace
----
table_name constraint_name constraint_type details validated
query TTTTT colnames
SHOW GRANTS ON pg_catalog.pg_namespace
----
database_name schema_name table_name grantee privilege_type
test pg_catalog pg_namespace public SELECT
# Verify selecting from pg_catalog.
statement ok
CREATE DATABASE constraint_db
statement ok
CREATE TABLE constraint_db.t1 (
p FLOAT PRIMARY KEY,
a INT UNIQUE,
b INT,
c INT DEFAULT 12,
d VARCHAR(5),
e BIT(5),
f DECIMAL(10,7),
g INT AS (a * b) STORED,
h CHAR(12)[],
i VARCHAR(20)[],
j "char",
k VARCHAR(10) COLLATE sv,
l INT AS (a * b) VIRTUAL,
m INT GENERATED ALWAYS AS IDENTITY,
n INT GENERATED BY DEFAULT AS IDENTITY,
UNIQUE INDEX index_key(b, c)
)
statement ok
CREATE TABLE constraint_db.t2 (
t1_ID INT,
CONSTRAINT fk FOREIGN KEY (t1_ID) REFERENCES constraint_db.t1(a),
INDEX (t1_ID)
)
statement ok
CREATE TABLE constraint_db.t3 (
a INT,
b INT CHECK (b > 11),
c STRING DEFAULT 'FOO' CHECK (c != ''),
CONSTRAINT fk FOREIGN KEY (a, b) REFERENCES constraint_db.t1(b, c),
INDEX (a, b DESC) STORING (c)
)
statement ok
CREATE VIEW constraint_db.v1 AS SELECT p,a,b,c FROM constraint_db.t1
statement ok
SET experimental_enable_unique_without_index_constraints = true
statement ok
CREATE TABLE constraint_db.t4 (
a INT UNIQUE WITHOUT INDEX,
b FLOAT,
c STRING,
CONSTRAINT uwi_b_c UNIQUE WITHOUT INDEX (b, c),
CONSTRAINT uwi_b_partial UNIQUE WITHOUT INDEX (b) WHERE c = 'foo'
)
statement ok
CREATE TABLE constraint_db.t5 (
a INT REFERENCES constraint_db.t4(a) ON DELETE CASCADE,
b FLOAT,
c STRING,
CONSTRAINT fk_b_c FOREIGN KEY (b, c) REFERENCES constraint_db.t4(b, c) MATCH FULL ON UPDATE RESTRICT
)
statement ok
CREATE TABLE constraint_db.t6 (
a INT,
b INT,
c STRING,
INDEX ((a + b))
);
CREATE INDEX ON constraint_db.t6 (lower(c), (a + b));
CREATE UNIQUE INDEX ON constraint_db.t6 (lower(c));
## pg_catalog.pg_namespace
query OTOT colnames
SELECT * FROM pg_catalog.pg_namespace
----
oid nspname nspowner nspacl
3604332469 crdb_internal NULL NULL
3672231114 information_schema NULL NULL
2508829085 pg_catalog NULL NULL
1841002695 pg_extension NULL NULL
3426283741 public 2310524507 NULL
## pg_catalog.pg_database
query OTOITTBB colnames
SELECT oid, datname, datdba, encoding, datcollate, datctype, datistemplate, datallowconn
FROM pg_catalog.pg_database
ORDER BY oid
----
oid datname datdba encoding datcollate datctype datistemplate datallowconn
1 system 3233629770 6 en_US.utf8 en_US.utf8 false true
50 defaultdb 1546506610 6 en_US.utf8 en_US.utf8 false true
51 postgres 1546506610 6 en_US.utf8 en_US.utf8 false true
52 test 1546506610 6 en_US.utf8 en_US.utf8 false true
54 constraint_db 1546506610 6 en_US.utf8 en_US.utf8 false true
query OTIOIIOT colnames
SELECT oid, datname, datconnlimit, datlastsysoid, datfrozenxid, datminmxid, dattablespace, datacl
FROM pg_catalog.pg_database
ORDER BY oid
----
oid datname datconnlimit datlastsysoid datfrozenxid datminmxid dattablespace datacl
1 system -1 0 NULL NULL 0 NULL
50 defaultdb -1 0 NULL NULL 0 NULL
51 postgres -1 0 NULL NULL 0 NULL
52 test -1 0 NULL NULL 0 NULL
54 constraint_db -1 0 NULL NULL 0 NULL
user testuser
# Should be globally visible
query OTIOIIOT colnames
SELECT oid, datname, datconnlimit, datlastsysoid, datfrozenxid, datminmxid, dattablespace, datacl
FROM pg_catalog.pg_database
ORDER BY oid LIMIT 1
----
oid datname datconnlimit datlastsysoid datfrozenxid datminmxid dattablespace datacl
1 system -1 0 NULL NULL 0 NULL
user root
## pg_catalog.pg_tables
statement ok
SET DATABASE = constraint_db
query TTTTBBBB colnames
SELECT * FROM constraint_db.pg_catalog.pg_tables WHERE schemaname = 'public'
----
schemaname tablename tableowner tablespace hasindexes hasrules hastriggers rowsecurity
public t1 root NULL true false false false
public t2 root NULL true false false false
public t3 root NULL true false false false
public t4 root NULL true false false false
public t5 root NULL true false false false
public t6 root NULL true false false false
query TB colnames
SELECT tablename, hasindexes FROM pg_catalog.pg_tables WHERE schemaname = 'information_schema' AND tablename LIKE '%table%'
----
tablename hasindexes
constraint_table_usage false
foreign_table_options false
foreign_tables false
role_table_grants false
table_constraints false
table_constraints_extensions false
table_privileges false
tables false
tables_extensions false
tablespaces false
tablespaces_extensions false
view_table_usage false
## pg_catalog.pg_tablespace
query OTOTT colnames
SELECT oid, spcname, spcowner, spcacl, spcoptions FROM pg_tablespace
----
oid spcname spcowner spcacl spcoptions
0 pg_default NULL NULL NULL
## pg_catalog.pg_views
query TTTT colnames
SELECT * FROM pg_catalog.pg_views
----
schemaname viewname viewowner definition
public v1 root SELECT p, a, b, c FROM constraint_db.public.t1
## pg_catalog.pg_matviews
statement ok
CREATE MATERIALIZED VIEW mv1 AS SELECT 1
query TTTTBBT colnames
SELECT * FROM pg_catalog.pg_matviews
----
schemaname matviewname matviewowner tablespace hasindexes ispopulated definition
public mv1 root NULL false true SELECT 1
## pg_catalog.pg_class
query OTOOOOOOO colnames
SELECT c.oid, relname, relnamespace, reltype, reloftype, relowner, relam, relfilenode, reltablespace
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
----
oid relname relnamespace reltype reloftype relowner relam relfilenode reltablespace
55 t1 2332901747 100055 0 1546506610 2631952481 0 0
450499963 t1_pkey 2332901747 0 0 1546506610 2631952481 0 0
450499960 t1_a_key 2332901747 0 0 1546506610 2631952481 0 0
450499961 index_key 2332901747 0 0 1546506610 2631952481 0 0
56 t1_m_seq 2332901747 100056 0 1546506610 0 0 0
57 t1_n_seq 2332901747 100057 0 1546506610 0 0 0
58 t2 2332901747 100058 0 1546506610 2631952481 0 0
710236230 t2_pkey 2332901747 0 0 1546506610 2631952481 0 0
710236229 t2_t1_id_idx 2332901747 0 0 1546506610 2631952481 0 0
59 t3 2332901747 100059 0 1546506610 2631952481 0 0
3660126519 t3_pkey 2332901747 0 0 1546506610 2631952481 0 0
3660126516 t3_a_b_idx 2332901747 0 0 1546506610 2631952481 0 0
60 v1 2332901747 100060 0 1546506610 0 0 0
61 t4 2332901747 100061 0 1546506610 2631952481 0 0
4179599057 t4_pkey 2332901747 0 0 1546506610 2631952481 0 0
62 t5 2332901747 100062 0 1546506610 2631952481 0 0
3919862786 t5_pkey 2332901747 0 0 1546506610 2631952481 0 0
63 t6 2332901747 100063 0 1546506610 2631952481 0 0
2574785779 t6_pkey 2332901747 0 0 1546506610 2631952481 0 0
2574785776 t6_expr_idx 2332901747 0 0 1546506610 2631952481 0 0
2574785777 t6_expr_expr1_idx 2332901747 0 0 1546506610 2631952481 0 0
2574785782 t6_expr_key 2332901747 0 0 1546506610 2631952481 0 0
64 mv1 2332901747 100064 0 1546506610 0 0 0
51576700 mv1_pkey 2332901747 0 0 1546506610 2631952481 0 0
query TIRIOBBT colnames
SELECT relname, relpages, reltuples, relallvisible, reltoastrelid, relhasindex, relisshared, relpersistence
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
----
relname relpages reltuples relallvisible reltoastrelid relhasindex relisshared relpersistence
t1 NULL NULL 0 0 true false p
t1_pkey NULL NULL 0 0 false false p
t1_a_key NULL NULL 0 0 false false p
index_key NULL NULL 0 0 false false p
t1_m_seq NULL NULL 0 0 true false p
t1_n_seq NULL NULL 0 0 true false p
t2 NULL NULL 0 0 true false p
t2_pkey NULL NULL 0 0 false false p
t2_t1_id_idx NULL NULL 0 0 false false p
t3 NULL NULL 0 0 true false p
t3_pkey NULL NULL 0 0 false false p
t3_a_b_idx NULL NULL 0 0 false false p
v1 NULL NULL 0 0 false false p
t4 NULL NULL 0 0 true false p
t4_pkey NULL NULL 0 0 false false p
t5 NULL NULL 0 0 true false p
t5_pkey NULL NULL 0 0 false false p
t6 NULL NULL 0 0 true false p
t6_pkey NULL NULL 0 0 false false p
t6_expr_idx NULL NULL 0 0 false false p
t6_expr_expr1_idx NULL NULL 0 0 false false p
t6_expr_key NULL NULL 0 0 false false p
mv1 NULL NULL 0 0 true false p
mv1_pkey NULL NULL 0 0 false false p
query TBTIIBB colnames
SELECT relname, relistemp, relkind, relnatts, relchecks, relhasoids, relhaspkey
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
----
relname relistemp relkind relnatts relchecks relhasoids relhaspkey
t1 false r 15 0 false true
t1_pkey false i 1 0 false false
t1_a_key false i 1 0 false false
index_key false i 2 0 false false
t1_m_seq false S 1 0 false true
t1_n_seq false S 1 0 false true
t2 false r 2 0 false true
t2_pkey false i 1 0 false false
t2_t1_id_idx false i 1 0 false false
t3 false r 4 2 false true
t3_pkey false i 1 0 false false
t3_a_b_idx false i 2 0 false false
v1 false v 4 0 false false
t4 false r 4 0 false true
t4_pkey false i 1 0 false false
t5 false r 4 0 false true
t5_pkey false i 1 0 false false
t6 false r 4 0 false true
t6_pkey false i 1 0 false false
t6_expr_idx false i 1 0 false false
t6_expr_expr1_idx false i 2 0 false false
t6_expr_key false i 1 0 false false
mv1 false m 2 0 false true
mv1_pkey false i 1 0 false false
query TBBBITT colnames
SELECT relname, relhasrules, relhastriggers, relhassubclass, relfrozenxid, relacl, reloptions
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
----
relname relhasrules relhastriggers relhassubclass relfrozenxid relacl reloptions
t1 false false false 0 NULL NULL
t1_pkey false false false 0 NULL NULL
t1_a_key false false false 0 NULL NULL
index_key false false false 0 NULL NULL
t1_m_seq false false false 0 NULL NULL
t1_n_seq false false false 0 NULL NULL
t2 false false false 0 NULL NULL
t2_pkey false false false 0 NULL NULL
t2_t1_id_idx false false false 0 NULL NULL
t3 false false false 0 NULL NULL
t3_pkey false false false 0 NULL NULL
t3_a_b_idx false false false 0 NULL NULL
v1 false false false 0 NULL NULL
t4 false false false 0 NULL NULL
t4_pkey false false false 0 NULL NULL
t5 false false false 0 NULL NULL
t5_pkey false false false 0 NULL NULL
t6 false false false 0 NULL NULL
t6_pkey false false false 0 NULL NULL
t6_expr_idx false false false 0 NULL NULL
t6_expr_expr1_idx false false false 0 NULL NULL
t6_expr_key false false false 0 NULL NULL
mv1 false false false 0 NULL NULL
mv1_pkey false false false 0 NULL NULL
## pg_catalog.pg_attribute
query OTTOIIIII colnames
SELECT attrelid, c.relname, attname, atttypid, attstattarget, attlen, attnum, attndims, attcacheoff
FROM pg_catalog.pg_attribute a
JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
----
attrelid relname attname atttypid attstattarget attlen attnum attndims attcacheoff
55 t1 p 701 0 8 1 0 -1
55 t1 a 20 0 8 2 0 -1
55 t1 b 20 0 8 3 0 -1
55 t1 c 20 0 8 4 0 -1
55 t1 d 1043 0 -1 5 0 -1
55 t1 e 1560 0 -1 6 0 -1
55 t1 f 1700 0 -1 7 0 -1
55 t1 g 20 0 8 8 0 -1
55 t1 h 1014 0 -1 9 0 -1
55 t1 i 1015 0 -1 10 0 -1
55 t1 j 18 0 1 11 0 -1
55 t1 k 1043 0 -1 12 0 -1
55 t1 l 20 0 8 13 0 -1
55 t1 m 20 0 8 14 0 -1
55 t1 n 20 0 8 15 0 -1
450499963 t1_pkey p 701 0 8 1 0 -1
450499960 t1_a_key a 20 0 8 2 0 -1
450499961 index_key b 20 0 8 3 0 -1
450499961 index_key c 20 0 8 4 0 -1
56 t1_m_seq value 20 0 8 1 0 -1
57 t1_n_seq value 20 0 8 1 0 -1
58 t2 t1_id 20 0 8 1 0 -1
58 t2 rowid 20 0 8 2 0 -1
710236230 t2_pkey rowid 20 0 8 2 0 -1
710236229 t2_t1_id_idx t1_id 20 0 8 1 0 -1
59 t3 a 20 0 8 1 0 -1
59 t3 b 20 0 8 2 0 -1
59 t3 c 25 0 -1 3 0 -1
59 t3 rowid 20 0 8 4 0 -1
3660126519 t3_pkey rowid 20 0 8 4 0 -1
3660126516 t3_a_b_idx a 20 0 8 1 0 -1
3660126516 t3_a_b_idx b 20 0 8 2 0 -1
60 v1 p 701 0 8 1 0 -1
60 v1 a 20 0 8 2 0 -1
60 v1 b 20 0 8 3 0 -1
60 v1 c 20 0 8 4 0 -1
61 t4 a 20 0 8 1 0 -1
61 t4 b 701 0 8 2 0 -1
61 t4 c 25 0 -1 3 0 -1
61 t4 rowid 20 0 8 4 0 -1
4179599057 t4_pkey rowid 20 0 8 4 0 -1
62 t5 a 20 0 8 1 0 -1
62 t5 b 701 0 8 2 0 -1
62 t5 c 25 0 -1 3 0 -1
62 t5 rowid 20 0 8 4 0 -1
3919862786 t5_pkey rowid 20 0 8 4 0 -1
63 t6 a 20 0 8 1 0 -1
63 t6 b 20 0 8 2 0 -1
63 t6 c 25 0 -1 3 0 -1
63 t6 rowid 20 0 8 5 0 -1
2574785779 t6_pkey rowid 20 0 8 5 0 -1
2574785776 t6_expr_idx crdb_internal_idx_expr 20 0 8 4 0 -1
2574785777 t6_expr_expr1_idx crdb_internal_idx_expr_1 25 0 -1 6 0 -1
2574785777 t6_expr_expr1_idx crdb_internal_idx_expr_2 20 0 8 7 0 -1
2574785782 t6_expr_key crdb_internal_idx_expr_3 25 0 -1 8 0 -1
64 mv1 ?column? 20 0 8 1 0 -1
64 mv1 rowid 20 0 8 2 0 -1
51576700 mv1_pkey rowid 20 0 8 2 0 -1
query TTIBTTBBTT colnames
SELECT c.relname, attname, atttypmod, attbyval, attstorage, attalign, attnotnull, atthasdef, attidentity, attgenerated
FROM pg_catalog.pg_attribute a
JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
----
relname attname atttypmod attbyval attstorage attalign attnotnull atthasdef attidentity attgenerated
t1 p -1 NULL NULL NULL true false · ·
t1 a -1 NULL NULL NULL false false · ·
t1 b -1 NULL NULL NULL false false · ·
t1 c -1 NULL NULL NULL false true · ·
t1 d 9 NULL NULL NULL false false · ·
t1 e 5 NULL NULL NULL false false · ·
t1 f 655371 NULL NULL NULL false false · ·
t1 g -1 NULL NULL NULL false false · s
t1 h 16 NULL NULL NULL false false · ·
t1 i 24 NULL NULL NULL false false · ·
t1 j -1 NULL NULL NULL false false · ·
t1 k 14 NULL NULL NULL false false · ·
t1 l -1 NULL NULL NULL false false · v
t1 m -1 NULL NULL NULL true true a ·
t1 n -1 NULL NULL NULL true true b ·
t1_pkey p -1 NULL NULL NULL true false · ·
t1_a_key a -1 NULL NULL NULL false false · ·
index_key b -1 NULL NULL NULL false false · ·
index_key c -1 NULL NULL NULL false true · ·
t1_m_seq value -1 NULL NULL NULL true false · ·
t1_n_seq value -1 NULL NULL NULL true false · ·
t2 t1_id -1 NULL NULL NULL false false · ·
t2 rowid -1 NULL NULL NULL true true · ·
t2_pkey rowid -1 NULL NULL NULL true true · ·
t2_t1_id_idx t1_id -1 NULL NULL NULL false false · ·
t3 a -1 NULL NULL NULL false false · ·
t3 b -1 NULL NULL NULL false false · ·
t3 c -1 NULL NULL NULL false true · ·
t3 rowid -1 NULL NULL NULL true true · ·
t3_pkey rowid -1 NULL NULL NULL true true · ·
t3_a_b_idx a -1 NULL NULL NULL false false · ·
t3_a_b_idx b -1 NULL NULL NULL false false · ·
v1 p -1 NULL NULL NULL false false · ·
v1 a -1 NULL NULL NULL false false · ·
v1 b -1 NULL NULL NULL false false · ·
v1 c -1 NULL NULL NULL false false · ·
t4 a -1 NULL NULL NULL false false · ·
t4 b -1 NULL NULL NULL false false · ·
t4 c -1 NULL NULL NULL false false · ·
t4 rowid -1 NULL NULL NULL true true · ·
t4_pkey rowid -1 NULL NULL NULL true true · ·
t5 a -1 NULL NULL NULL false false · ·
t5 b -1 NULL NULL NULL false false · ·
t5 c -1 NULL NULL NULL false false · ·
t5 rowid -1 NULL NULL NULL true true · ·
t5_pkey rowid -1 NULL NULL NULL true true · ·
t6 a -1 NULL NULL NULL false false · ·
t6 b -1 NULL NULL NULL false false · ·
t6 c -1 NULL NULL NULL false false · ·
t6 rowid -1 NULL NULL NULL true true · ·
t6_pkey rowid -1 NULL NULL NULL true true · ·
t6_expr_idx crdb_internal_idx_expr -1 NULL NULL NULL false false · v
t6_expr_expr1_idx crdb_internal_idx_expr_1 -1 NULL NULL NULL false false · v
t6_expr_expr1_idx crdb_internal_idx_expr_2 -1 NULL NULL NULL false false · v
t6_expr_key crdb_internal_idx_expr_3 -1 NULL NULL NULL false false · v
mv1 ?column? -1 NULL NULL NULL false false · ·
mv1 rowid -1 NULL NULL NULL true true · ·
mv1_pkey rowid -1 NULL NULL NULL true true · ·
query TTBBITTT colnames
SELECT c.relname, attname, attisdropped, attislocal, attinhcount, attacl, attoptions, attfdwoptions
FROM pg_catalog.pg_attribute a
JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
----
relname attname attisdropped attislocal attinhcount attacl attoptions attfdwoptions
t1 p false true 0 NULL NULL NULL
t1 a false true 0 NULL NULL NULL
t1 b false true 0 NULL NULL NULL
t1 c false true 0 NULL NULL NULL
t1 d false true 0 NULL NULL NULL
t1 e false true 0 NULL NULL NULL
t1 f false true 0 NULL NULL NULL
t1 g false true 0 NULL NULL NULL
t1 h false true 0 NULL NULL NULL
t1 i false true 0 NULL NULL NULL
t1 j false true 0 NULL NULL NULL
t1 k false true 0 NULL NULL NULL
t1 l false true 0 NULL NULL NULL
t1 m false true 0 NULL NULL NULL
t1 n false true 0 NULL NULL NULL
t1_pkey p false true 0 NULL NULL NULL
t1_a_key a false true 0 NULL NULL NULL
index_key b false true 0 NULL NULL NULL
index_key c false true 0 NULL NULL NULL
t1_m_seq value false true 0 NULL NULL NULL
t1_n_seq value false true 0 NULL NULL NULL
t2 t1_id false true 0 NULL NULL NULL
t2 rowid false true 0 NULL NULL NULL
t2_pkey rowid false true 0 NULL NULL NULL
t2_t1_id_idx t1_id false true 0 NULL NULL NULL
t3 a false true 0 NULL NULL NULL
t3 b false true 0 NULL NULL NULL
t3 c false true 0 NULL NULL NULL
t3 rowid false true 0 NULL NULL NULL
t3_pkey rowid false true 0 NULL NULL NULL
t3_a_b_idx a false true 0 NULL NULL NULL
t3_a_b_idx b false true 0 NULL NULL NULL
v1 p false true 0 NULL NULL NULL
v1 a false true 0 NULL NULL NULL
v1 b false true 0 NULL NULL NULL
v1 c false true 0 NULL NULL NULL
t4 a false true 0 NULL NULL NULL
t4 b false true 0 NULL NULL NULL
t4 c false true 0 NULL NULL NULL
t4 rowid false true 0 NULL NULL NULL
t4_pkey rowid false true 0 NULL NULL NULL
t5 a false true 0 NULL NULL NULL
t5 b false true 0 NULL NULL NULL
t5 c false true 0 NULL NULL NULL
t5 rowid false true 0 NULL NULL NULL
t5_pkey rowid false true 0 NULL NULL NULL
t6 a false true 0 NULL NULL NULL
t6 b false true 0 NULL NULL NULL
t6 c false true 0 NULL NULL NULL
t6 rowid false true 0 NULL NULL NULL
t6_pkey rowid false true 0 NULL NULL NULL
t6_expr_idx crdb_internal_idx_expr false true 0 NULL NULL NULL
t6_expr_expr1_idx crdb_internal_idx_expr_1 false true 0 NULL NULL NULL
t6_expr_expr1_idx crdb_internal_idx_expr_2 false true 0 NULL NULL NULL
t6_expr_key crdb_internal_idx_expr_3 false true 0 NULL NULL NULL
mv1 ?column? false true 0 NULL NULL NULL
mv1 rowid false true 0 NULL NULL NULL
mv1_pkey rowid false true 0 NULL NULL NULL
# Check relkind codes.
statement ok
CREATE DATABASE relkinds
statement ok
SET DATABASE = relkinds
statement ok
CREATE TABLE tbl_test (k int primary key, v int)
statement ok
CREATE INDEX tbl_test_v_idx ON tbl_test (v)
statement ok
CREATE VIEW view_test AS SELECT k, v FROM tbl_test ORDER BY v
statement ok
CREATE MATERIALIZED VIEW mv_test AS SELECT 1
statement ok
CREATE SEQUENCE seq_test
query TT
SELECT relname, relkind
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
ORDER BY relname
----
mv_test m
mv_test_pkey i
seq_test S
tbl_test r
tbl_test_pkey i
tbl_test_v_idx i
view_test v
statement ok
DROP DATABASE relkinds
statement ok
SET DATABASE = constraint_db
# Select all columns with collations.
query TTTOT colnames,rowsort
SELECT c.relname, attname, t.typname, attcollation, k.collname
FROM pg_catalog.pg_attribute a
JOIN pg_catalog.pg_class c ON a.attrelid = c.oid
JOIN pg_catalog.pg_type t ON a.atttypid = t.oid
JOIN pg_catalog.pg_collation k ON a.attcollation = k.oid
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
----
relname attname typname attcollation collname
t1 d varchar 3403232968 default
t6_expr_key crdb_internal_idx_expr_3 text 3403232968 default
t6_expr_expr1_idx crdb_internal_idx_expr_1 text 3403232968 default
t6 c text 3403232968 default
t5 c text 3403232968 default
t4 c text 3403232968 default
t3 c text 3403232968 default
t1 j char 3403232968 default
t1 i _varchar 3403232968 default
t1 h _bpchar 3403232968 default
t1 k varchar 999873346 sv
## pg_catalog.pg_am
query OTIIBBBBBBBBBBBOOOOOOOOOOOOOOOOOT colnames
SELECT *
FROM pg_catalog.pg_am
----
oid amname amstrategies amsupport amcanorder amcanorderbyop amcanbackward amcanunique amcanmulticol amoptionalkey amsearcharray amsearchnulls amstorage amclusterable ampredlocks amkeytype aminsert ambeginscan amgettuple amgetbitmap amrescan amendscan ammarkpos amrestrpos ambuild ambuildempty ambulkdelete amvacuumcleanup amcanreturn amcostestimate amoptions amhandler amtype
2631952481 prefix 0 0 true false true true true true true true false false false 0 NULL NULL 0 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL i
4004609370 inverted 0 0 false false false false false false false true false false false 0 NULL NULL 0 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL i
## pg_catalog.pg_attrdef
query OTOITTT colnames
SELECT ad.oid, c.relname, adrelid, adnum, adbin, adsrc, pg_get_expr(ad.adbin, ad.adrelid)
FROM pg_catalog.pg_attrdef ad
JOIN pg_catalog.pg_class c ON ad.adrelid = c.oid
JOIN pg_catalog.pg_namespace n ON c.relnamespace = n.oid
WHERE n.nspname = 'public'
----
oid relname adrelid adnum adbin adsrc pg_get_expr
1666782879 t1 55 4 12 12 12
1666782869 t1 55 14 nextval('public.t1_m_seq'::REGCLASS) nextval('public.t1_m_seq'::REGCLASS) nextval('public.t1_m_seq'::REGCLASS)
1666782868 t1 55 15 nextval('public.t1_n_seq'::REGCLASS) nextval('public.t1_n_seq'::REGCLASS) nextval('public.t1_n_seq'::REGCLASS)
3531332420 t2 58 2 unique_rowid() unique_rowid() unique_rowid()
581442132 t3 59 3 'FOO'::STRING 'FOO'::STRING 'FOO'::STRING
581442131 t3 59 4 unique_rowid() unique_rowid() unique_rowid()
1100914677 t4 61 4 unique_rowid() unique_rowid() unique_rowid()
2445991686 t5 62 4 unique_rowid() unique_rowid() unique_rowid()
3791068694 t6 63 5 unique_rowid() unique_rowid() unique_rowid()
2779881566 mv1 64 2 unique_rowid() unique_rowid() unique_rowid()
## pg_catalog.pg_indexes
query OTTTT colnames
SELECT crdb_oid, schemaname, tablename, indexname, tablespace
FROM pg_catalog.pg_indexes
WHERE schemaname = 'public'
----
crdb_oid schemaname tablename indexname tablespace
450499963 public t1 t1_pkey NULL
450499960 public t1 t1_a_key NULL
450499961 public t1 index_key NULL
2315049508 public t1_m_seq primary NULL
969972501 public t1_n_seq primary NULL
710236230 public t2 t2_pkey NULL
710236229 public t2 t2_t1_id_idx NULL
3660126519 public t3 t3_pkey NULL
3660126516 public t3 t3_a_b_idx NULL
4179599057 public t4 t4_pkey NULL
3919862786 public t5 t5_pkey NULL
2574785779 public t6 t6_pkey NULL
2574785776 public t6 t6_expr_idx NULL
2574785777 public t6 t6_expr_expr1_idx NULL
2574785782 public t6 t6_expr_key NULL
51576700 public mv1 mv1_pkey NULL
query OTTT colnames
SELECT crdb_oid, tablename, indexname, indexdef
FROM pg_catalog.pg_indexes
WHERE schemaname = 'public'
----
crdb_oid tablename indexname indexdef
450499963 t1 t1_pkey CREATE UNIQUE INDEX t1_pkey ON constraint_db.public.t1 USING btree (p ASC)
450499960 t1 t1_a_key CREATE UNIQUE INDEX t1_a_key ON constraint_db.public.t1 USING btree (a ASC)
450499961 t1 index_key CREATE UNIQUE INDEX index_key ON constraint_db.public.t1 USING btree (b ASC, c ASC)
2315049508 t1_m_seq primary CREATE INDEX "primary" ON constraint_db.public.t1_m_seq USING btree (value ASC)
969972501 t1_n_seq primary CREATE INDEX "primary" ON constraint_db.public.t1_n_seq USING btree (value ASC)
710236230 t2 t2_pkey CREATE UNIQUE INDEX t2_pkey ON constraint_db.public.t2 USING btree (rowid ASC)
710236229 t2 t2_t1_id_idx CREATE INDEX t2_t1_id_idx ON constraint_db.public.t2 USING btree (t1_id ASC)
3660126519 t3 t3_pkey CREATE UNIQUE INDEX t3_pkey ON constraint_db.public.t3 USING btree (rowid ASC)
3660126516 t3 t3_a_b_idx CREATE INDEX t3_a_b_idx ON constraint_db.public.t3 USING btree (a ASC, b DESC) STORING (c)
4179599057 t4 t4_pkey CREATE UNIQUE INDEX t4_pkey ON constraint_db.public.t4 USING btree (rowid ASC)
3919862786 t5 t5_pkey CREATE UNIQUE INDEX t5_pkey ON constraint_db.public.t5 USING btree (rowid ASC)
2574785779 t6 t6_pkey CREATE UNIQUE INDEX t6_pkey ON constraint_db.public.t6 USING btree (rowid ASC)