Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: Display inherited constraints in SHOW PARTITIONS #40493

Merged
merged 1 commit into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pkg/base/zone.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2019 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 base

// SubzoneID represents a subzone within a zone. It's the subzone's index within
// the parent zone + 1; there's no subzone 0 so that 0 can be used as a
// sentinel.
type SubzoneID uint32

// SubzoneIDFromIndex turns a subzone's index within its parent zone into its
// SubzoneID.
func SubzoneIDFromIndex(idx int) SubzoneID {
return SubzoneID(idx + 1)
}
28 changes: 15 additions & 13 deletions pkg/ccl/logictestccl/testdata/logic_test/crdb_internal
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# LogicTest: local

query IITTITTT colnames
query IITTITTTII colnames
SELECT * FROM crdb_internal.partitions
----
table_id index_id parent_name name columns column_names list_value range_value
table_id index_id parent_name name columns column_names list_value range_value zone_id subzone_id

statement ok
CREATE TABLE t1 (
Expand Down Expand Up @@ -33,16 +33,18 @@ CREATE table t2 (a STRING PRIMARY KEY) PARTITION BY LIST (a) (
PARTITION pfoo VALUES IN ('foo')
)

query IITTITTT
# Since there are no zone configurations on any of these partitions, tables,
# or databases, these partitions inherit directly from the default config.
query IITTITTTII
SELECT * FROM crdb_internal.partitions ORDER BY table_id, index_id, name
----
53 1 NULL p12 1 a (1), (2) NULL
53 1 p12 p12p3 1 b (3) NULL
53 1 p12p3 p12p3p8 1 c (8) NULL
53 1 NULL p6 1 a (6) NULL
53 1 p6 p6p7 1 b NULL (MINVALUE) TO (7)
53 1 p6 p6p8 1 b NULL (7) TO (8)
53 1 p6 p6px 1 b NULL (8) TO (MAXVALUE)
53 1 p12 pd 1 b (DEFAULT) NULL
53 2 NULL p00 2 a, b (0, 0) NULL
54 1 NULL pfoo 1 a ('foo') NULL
53 1 NULL p12 1 a (1), (2) NULL 0 0
53 1 p12 p12p3 1 b (3) NULL 0 0
53 1 p12p3 p12p3p8 1 c (8) NULL 0 0
53 1 NULL p6 1 a (6) NULL 0 0
53 1 p6 p6p7 1 b NULL (MINVALUE) TO (7) 0 0
53 1 p6 p6p8 1 b NULL (7) TO (8) 0 0
53 1 p6 p6px 1 b NULL (8) TO (MAXVALUE) 0 0
53 1 p12 pd 1 b (DEFAULT) NULL 0 0
53 2 NULL p00 2 a, b (0, 0) NULL 0 0
54 1 NULL pfoo 1 a ('foo') NULL 0 0
Loading