-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
Copy pathconstants.go
445 lines (431 loc) · 17.2 KB
/
constants.go
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
// Copyright 2017 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package catconstants
import "math"
// ReportableAppNamePrefix indicates that the application name can be
// reported in telemetry without scrubbing. (Note this only applies to
// the application name itself. Query data is still scrubbed as
// usual.)
const ReportableAppNamePrefix = "$ "
// InternalAppNamePrefix indicates that the application name identifies
// an internal task / query / job to CockroachDB. Different application
// names are used to classify queries in different categories.
const InternalAppNamePrefix = ReportableAppNamePrefix + "internal"
// DelegatedAppNamePrefix is added to a regular client application
// name for SQL queries that are ran internally on behalf of other SQL
// queries inside that application. This is not the same as
// ReportableAppNamePrefix; in particular the application name with
// DelegatedAppNamePrefix should be scrubbed in reporting.
const DelegatedAppNamePrefix = "$$ "
// InternalSQLAppName is the application_name used by
// the cockroach CLI by default
const InternalSQLAppName = "cockroach sql"
// SystemDatabaseName is the name of the system database.
const SystemDatabaseName = "system"
// SystemTableName is a type for system table names.
type SystemTableName string
// SystemTenantName is the tenant name of the system tenant.
const SystemTenantName = "system"
// Names of tables in the system database.
const (
NamespaceTableName SystemTableName = "namespace"
DescriptorTableName SystemTableName = "descriptor"
UsersTableName SystemTableName = "users"
ZonesTableName SystemTableName = "zones"
SettingsTableName SystemTableName = "settings"
DescIDSequenceTableName SystemTableName = "descriptor_id_seq"
TenantIDSequenceTableName SystemTableName = "tenant_id_seq"
TenantsTableName SystemTableName = "tenants"
LeaseTableName SystemTableName = "lease"
EventLogTableName SystemTableName = "eventlog"
RangeEventTableName SystemTableName = "rangelog"
UITableName SystemTableName = "ui"
JobsTableName SystemTableName = "jobs"
WebSessionsTableName SystemTableName = "web_sessions"
TableStatisticsTableName SystemTableName = "table_statistics"
LocationsTableName SystemTableName = "locations"
RoleMembersTableName SystemTableName = "role_members"
CommentsTableName SystemTableName = "comments"
ReportsMetaTableName SystemTableName = "reports_meta"
ReplicationConstraintStatsTableName SystemTableName = "replication_constraint_stats"
ReplicationCriticalLocalitiesTableName SystemTableName = "replication_critical_localities"
ReplicationStatsTableName SystemTableName = "replication_stats"
ProtectedTimestampsMetaTableName SystemTableName = "protected_ts_meta"
ProtectedTimestampsRecordsTableName SystemTableName = "protected_ts_records"
RoleOptionsTableName SystemTableName = "role_options"
StatementBundleChunksTableName SystemTableName = "statement_bundle_chunks"
StatementDiagnosticsRequestsTableName SystemTableName = "statement_diagnostics_requests"
StatementDiagnosticsTableName SystemTableName = "statement_diagnostics"
ScheduledJobsTableName SystemTableName = "scheduled_jobs"
SqllivenessTableName SystemTableName = "sqlliveness"
MigrationsTableName SystemTableName = "migrations"
JoinTokensTableName SystemTableName = "join_tokens"
StatementStatisticsTableName SystemTableName = "statement_statistics"
TransactionStatisticsTableName SystemTableName = "transaction_statistics"
StatementActivityTableName SystemTableName = "statement_activity"
TransactionActivityTableName SystemTableName = "transaction_activity"
DatabaseRoleSettingsTableName SystemTableName = "database_role_settings"
TenantUsageTableName SystemTableName = "tenant_usage"
SQLInstancesTableName SystemTableName = "sql_instances"
SpanConfigurationsTableName SystemTableName = "span_configurations"
TaskPayloadsTableName SystemTableName = "task_payloads"
TenantSettingsTableName SystemTableName = "tenant_settings"
TenantTasksTableName SystemTableName = "tenant_tasks"
SpanCountTableName SystemTableName = "span_count"
SystemPrivilegeTableName SystemTableName = "privileges"
SystemExternalConnectionsTableName SystemTableName = "external_connections"
RoleIDSequenceName SystemTableName = "role_id_seq"
SystemJobInfoTableName SystemTableName = "job_info"
SpanStatsUniqueKeys SystemTableName = "span_stats_unique_keys"
SpanStatsBuckets SystemTableName = "span_stats_buckets"
SpanStatsSamples SystemTableName = "span_stats_samples"
SpanStatsTenantBoundaries SystemTableName = "span_stats_tenant_boundaries"
RegionalLiveness SystemTableName = "region_liveness"
MVCCStatisticsCache SystemTableName = "mvcc_statistics_cache"
)
// Oid for virtual database and table.
const (
CrdbInternalID = math.MaxUint32 - iota
CrdbInternalBackwardDependenciesTableID
CrdbInternalBuildInfoTableID
CrdbInternalBuiltinFunctionsTableID
CrdbInternalBuiltinFunctionCommentsTableID
CrdbInternalCatalogCommentsTableID
CrdbInternalCatalogDescriptorTableID
CrdbInternalCatalogNamespaceTableID
CrdbInternalCatalogZonesTableID
CrdbInternalClusterContendedIndexesViewID
CrdbInternalClusterContendedKeysViewID
CrdbInternalClusterContendedTablesViewID
CrdbInternalClusterContentionEventsTableID
CrdbInternalClusterDistSQLFlowsTableID
CrdbInternalClusterExecutionInsightsTableID
CrdbInternalClusterTxnExecutionInsightsTableID
CrdbInternalNodeTxnExecutionInsightsTableID
CrdbInternalClusterLocksTableID
CrdbInternalClusterQueriesTableID
CrdbInternalClusterTransactionsTableID
CrdbInternalClusterSessionsTableID
CrdbInternalClusterSettingsTableID
CrdbInternalClusterStmtStatsTableID
CrdbInternalClusterTxnStatsTableID
CrdbInternalCreateFunctionStmtsTableID
CrdbInternalCreateSchemaStmtsTableID
CrdbInternalCreateStmtsTableID
CrdbInternalCreateTypeStmtsTableID
CrdbInternalDatabasesTableID
CrdbInternalFeatureUsageID
CrdbInternalForwardDependenciesTableID
CrdbInternalKVNodeLivenessTableID
CrdbInternalGossipNodesTableID
CrdbInternalGossipAlertsTableID
CrdbInternalGossipLivenessTableID
CrdbInternalGossipNetworkTableID
CrdbInternalTransactionContentionEvents
CrdbInternalIndexColumnsTableID
CrdbInternalIndexSpansTableID
CrdbInternalIndexUsageStatisticsTableID
CrdbInternalInflightTraceSpanTableID
CrdbInternalJobsTableID
CrdbInternalSystemJobsTableID
CrdbInternalKVNodeStatusTableID
CrdbInternalKVStoreStatusTableID
CrdbInternalLeasesTableID
CrdbInternalLocalContentionEventsTableID
CrdbInternalLocalDistSQLFlowsTableID
CrdbInternalNodeExecutionInsightsTableID
CrdbInternalLocalQueriesTableID
CrdbInternalLocalTransactionsTableID
CrdbInternalLocalSessionsTableID
CrdbInternalLocalMetricsTableID
CrdbInternalNodeMemoryMonitorsTableID
CrdbInternalNodeStmtStatsTableID
CrdbInternalNodeTxnStatsTableID
CrdbInternalPartitionsTableID
CrdbInternalRangesNoLeasesTableID
CrdbInternalRangesViewID
CrdbInternalRuntimeInfoTableID
CrdbInternalSchemaChangesTableID
CrdbInternalSessionTraceTableID
CrdbInternalSessionVariablesTableID
CrdbInternalStmtActivityTableID
CrdbInternalStmtStatsTableID
CrdbInternalStmtStatsPersistedTableID
CrdbInternalStmtStatsPersistedV22_2TableID
CrdbInternalTableColumnsTableID
CrdbInternalTableIndexesTableID
CrdbInternalTableSpansTableID
CrdbInternalTablesTableID
CrdbInternalTablesTableLastStatsID
CrdbInternalTransactionStatsTableID
CrdbInternalTxnActivityTableID
CrdbInternalTxnStatsTableID
CrdbInternalTxnStatsPersistedTableID
CrdbInternalTxnStatsPersistedV22_2TableID
CrdbInternalZonesTableID
CrdbInternalInvalidDescriptorsTableID
CrdbInternalClusterDatabasePrivilegesTableID
CrdbInternalCrossDbRefrences
CrdbInternalLostTableDescriptors
CrdbInternalClusterInflightTracesTable
CrdbInternalRegionsTable
CrdbInternalDefaultPrivilegesTable
CrdbInternalActiveRangeFeedsTable
CrdbInternalTenantUsageDetailsViewID
CrdbInternalPgCatalogTableIsImplementedTableID
CrdbInternalSuperRegions
CrdbInternalDroppedRelationsViewID
CrdbInternalShowTenantCapabilitiesCacheTableID
CrdbInternalInheritedRoleMembersTableID
CrdbInternalKVSystemPrivilegesViewID
CrdbInternalKVFlowControllerID
CrdbInternalKVFlowHandlesID
CrdbInternalKVFlowTokenDeductions
CrdbInternalRepairableCatalogCorruptionsViewID
CrdbInternalKVProtectedTS
InformationSchemaID
InformationSchemaAdministrableRoleAuthorizationsID
InformationSchemaApplicableRolesID
InformationSchemaAttributesTableID
InformationSchemaCharacterSets
InformationSchemaCheckConstraintRoutineUsageTableID
InformationSchemaCheckConstraints
InformationSchemaCollationCharacterSetApplicability
InformationSchemaCollations
InformationSchemaColumnColumnUsageTableID
InformationSchemaColumnDomainUsageTableID
InformationSchemaColumnOptionsTableID
InformationSchemaColumnPrivilegesID
InformationSchemaColumnStatisticsTableID
InformationSchemaColumnUDTUsageID
InformationSchemaColumnsExtensionsTableID
InformationSchemaColumnsTableID
InformationSchemaConstraintColumnUsageTableID
InformationSchemaConstraintTableUsageTableID
InformationSchemaDataTypePrivilegesTableID
InformationSchemaDomainConstraintsTableID
InformationSchemaDomainUdtUsageTableID
InformationSchemaDomainsTableID
InformationSchemaElementTypesTableID
InformationSchemaEnabledRolesID
InformationSchemaEnginesTableID
InformationSchemaEventsTableID
InformationSchemaFilesTableID
InformationSchemaForeignDataWrapperOptionsTableID
InformationSchemaForeignDataWrappersTableID
InformationSchemaForeignServerOptionsTableID
InformationSchemaForeignServersTableID
InformationSchemaForeignTableOptionsTableID
InformationSchemaForeignTablesTableID
InformationSchemaInformationSchemaCatalogNameTableID
InformationSchemaKeyColumnUsageTableID
InformationSchemaKeywordsTableID
InformationSchemaOptimizerTraceTableID
InformationSchemaParametersTableID
InformationSchemaPartitionsTableID
InformationSchemaPluginsTableID
InformationSchemaProcesslistTableID
InformationSchemaProfilingTableID
InformationSchemaReferentialConstraintsTableID
InformationSchemaResourceGroupsTableID
InformationSchemaRoleColumnGrantsTableID
InformationSchemaRoleRoutineGrantsTableID
InformationSchemaRoleTableGrantsID
InformationSchemaRoleUdtGrantsTableID
InformationSchemaRoleUsageGrantsTableID
InformationSchemaRoutinePrivilegesTableID
InformationSchemaRoutineTableID
InformationSchemaSQLFeaturesTableID
InformationSchemaSQLImplementationInfoTableID
InformationSchemaSQLPartsTableID
InformationSchemaSQLSizingTableID
InformationSchemaSchemataExtensionsTableID
InformationSchemaSchemataTableID
InformationSchemaSchemataTablePrivilegesID
InformationSchemaSequencesID
InformationSchemaSessionVariables
InformationSchemaStGeometryColumnsTableID
InformationSchemaStSpatialReferenceSystemsTableID
InformationSchemaStUnitsOfMeasureTableID
InformationSchemaStatisticsTableID
InformationSchemaTableConstraintTableID
InformationSchemaTableConstraintsExtensionsTableID
InformationSchemaTablePrivilegesID
InformationSchemaTablesExtensionsTableID
InformationSchemaTablesTableID
InformationSchemaTablespacesExtensionsTableID
InformationSchemaTablespacesTableID
InformationSchemaTransformsTableID
InformationSchemaTriggeredUpdateColumnsTableID
InformationSchemaTriggersTableID
InformationSchemaTypePrivilegesID
InformationSchemaUdtPrivilegesTableID
InformationSchemaUsagePrivilegesTableID
InformationSchemaUserAttributesTableID
InformationSchemaUserDefinedTypesTableID
InformationSchemaUserMappingOptionsTableID
InformationSchemaUserMappingsTableID
InformationSchemaUserPrivilegesID
InformationSchemaViewColumnUsageTableID
InformationSchemaViewRoutineUsageTableID
InformationSchemaViewTableUsageTableID
InformationSchemaViewsTableID
PgCatalogID
PgCatalogAggregateTableID
PgCatalogAmTableID
PgCatalogAmopTableID
PgCatalogAmprocTableID
PgCatalogAttrDefTableID
PgCatalogAttributeTableID
PgCatalogAuthIDTableID
PgCatalogAuthMembersTableID
PgCatalogAvailableExtensionVersionsTableID
PgCatalogAvailableExtensionsTableID
PgCatalogCastTableID
PgCatalogClassTableID
PgCatalogCollationTableID
PgCatalogConfigTableID
PgCatalogConstraintTableID
PgCatalogConversionTableID
PgCatalogCursorsTableID
PgCatalogDatabaseTableID
PgCatalogDbRoleSettingTableID
PgCatalogDefaultACLTableID
PgCatalogDependTableID
PgCatalogDescriptionTableID
PgCatalogEnumTableID
PgCatalogEventTriggerTableID
PgCatalogExtensionTableID
PgCatalogFileSettingsTableID
PgCatalogForeignDataWrapperTableID
PgCatalogForeignServerTableID
PgCatalogForeignTableTableID
PgCatalogGroupTableID
PgCatalogHbaFileRulesTableID
PgCatalogIndexTableID
PgCatalogIndexesTableID
PgCatalogInheritsTableID
PgCatalogInitPrivsTableID
PgCatalogLanguageTableID
PgCatalogLargeobjectMetadataTableID
PgCatalogLargeobjectTableID
PgCatalogLocksTableID
PgCatalogMatViewsTableID
PgCatalogNamespaceTableID
PgCatalogOpclassTableID
PgCatalogOperatorTableID
PgCatalogOpfamilyTableID
PgCatalogPartitionedTableTableID
PgCatalogPoliciesTableID
PgCatalogPolicyTableID
PgCatalogPreparedStatementsTableID
PgCatalogPreparedXactsTableID
PgCatalogProcTableID
PgCatalogPublicationRelTableID
PgCatalogPublicationTableID
PgCatalogPublicationTablesTableID
PgCatalogRangeTableID
PgCatalogReplicationOriginStatusTableID
PgCatalogReplicationOriginTableID
PgCatalogReplicationSlotsTableID
PgCatalogRewriteTableID
PgCatalogRolesTableID
PgCatalogRulesTableID
PgCatalogSecLabelsTableID
PgCatalogSecurityLabelTableID
PgCatalogSequenceTableID
PgCatalogSequencesTableID
PgCatalogSettingsTableID
PgCatalogShadowTableID
PgCatalogSharedDescriptionTableID
PgCatalogSharedSecurityLabelTableID
PgCatalogShdependTableID
PgCatalogShmemAllocationsTableID
PgCatalogStatActivityTableID
PgCatalogStatAllIndexesTableID
PgCatalogStatAllTablesTableID
PgCatalogStatArchiverTableID
PgCatalogStatBgwriterTableID
PgCatalogStatDatabaseConflictsTableID
PgCatalogStatDatabaseTableID
PgCatalogStatGssapiTableID
PgCatalogStatProgressAnalyzeTableID
PgCatalogStatProgressBasebackupTableID
PgCatalogStatProgressClusterTableID
PgCatalogStatProgressCreateIndexTableID
PgCatalogStatProgressVacuumTableID
PgCatalogStatReplicationTableID
PgCatalogStatSlruTableID
PgCatalogStatSslTableID
PgCatalogStatSubscriptionTableID
PgCatalogStatSysIndexesTableID
PgCatalogStatSysTablesTableID
PgCatalogStatUserFunctionsTableID
PgCatalogStatUserIndexesTableID
PgCatalogStatUserTablesTableID
PgCatalogStatWalReceiverTableID
PgCatalogStatXactAllTablesTableID
PgCatalogStatXactSysTablesTableID
PgCatalogStatXactUserFunctionsTableID
PgCatalogStatXactUserTablesTableID
PgCatalogStatioAllIndexesTableID
PgCatalogStatioAllSequencesTableID
PgCatalogStatioAllTablesTableID
PgCatalogStatioSysIndexesTableID
PgCatalogStatioSysSequencesTableID
PgCatalogStatioSysTablesTableID
PgCatalogStatioUserIndexesTableID
PgCatalogStatioUserSequencesTableID
PgCatalogStatioUserTablesTableID
PgCatalogStatisticExtDataTableID
PgCatalogStatisticExtTableID
PgCatalogStatisticTableID
PgCatalogStatsExtTableID
PgCatalogStatsTableID
PgCatalogSubscriptionRelTableID
PgCatalogSubscriptionTableID
PgCatalogTablesTableID
PgCatalogTablespaceTableID
PgCatalogTimezoneAbbrevsTableID
PgCatalogTimezoneNamesTableID
PgCatalogTransformTableID
PgCatalogTriggerTableID
PgCatalogTsConfigMapTableID
PgCatalogTsConfigTableID
PgCatalogTsDictTableID
PgCatalogTsParserTableID
PgCatalogTsTemplateTableID
PgCatalogTypeTableID
PgCatalogUserMappingTableID
PgCatalogUserMappingsTableID
PgCatalogUserTableID
PgCatalogViewsTableID
PgExtensionSchemaID
PgExtensionGeographyColumnsTableID
PgExtensionGeometryColumnsTableID
PgExtensionSpatialRefSysTableID
MinVirtualID = PgExtensionSpatialRefSysTableID
)
// ConstraintType is used to identify the type of a constraint.
type ConstraintType string
const (
// ConstraintTypePK identifies a PRIMARY KEY constraint.
ConstraintTypePK ConstraintType = "PRIMARY KEY"
// ConstraintTypeFK identifies a FOREIGN KEY constraint.
ConstraintTypeFK ConstraintType = "FOREIGN KEY"
// ConstraintTypeUnique identifies a UNIQUE constraint.
ConstraintTypeUnique ConstraintType = "UNIQUE"
// ConstraintTypeCheck identifies a CHECK constraint.
ConstraintTypeCheck ConstraintType = "CHECK"
// ConstraintTypeUniqueWithoutIndex identifies a UNIQUE_WITHOUT_INDEX constraint.
ConstraintTypeUniqueWithoutIndex ConstraintType = "UNIQUE WITHOUT INDEX"
)
// SafeValue implements the redact.SafeValue interface.
func (ConstraintType) SafeValue() {}