Skip to content

Commit

Permalink
Merge pull request #2306 from cockroachdb/marc/change_desc_columns
Browse files Browse the repository at this point in the history
Change system.descriptor column from desc to descriptor.
  • Loading branch information
mberhault committed Aug 31, 2015
2 parents b1d9a38 + 796a5ec commit 68c5b18
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
6 changes: 3 additions & 3 deletions sql/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ database/table name to ID and from ID to descriptor:
);
CREATE TABLE system.descriptor (
"id" INT PRIMARY KEY,
"desc" BLOB
"id" INT PRIMARY KEY,
"descriptor" BLOB
);
The reserved ID of 0 is used for the "root" of the namespace in which the
Expand All @@ -82,7 +82,7 @@ system effectively does a query like:
And given a database/table ID, the system looks up the descriptor using a query
like:
SELECT desc FROM system.descriptor WHERE id = <ID>
SELECT descriptor FROM system.descriptor WHERE id = <ID>
Primary Key Addressing
Expand Down
14 changes: 7 additions & 7 deletions sql/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ const (
// TODO(marc): wouldn't it be better to use a pre-parsed version?
namespaceTableSchema = `
CREATE TABLE system.namespace (
"parentID" INT,
"name" CHAR,
"id" INT,
parentID INT,
name CHAR,
id INT,
PRIMARY KEY (parentID, name)
);`

descriptorTableSchema = `
CREATE TABLE system.descriptor (
"id" INT PRIMARY KEY,
"desc" BLOB
id INT PRIMARY KEY,
descriptor BLOB
);`

usersTableSchema = `
CREATE TABLE system.users (
"username" CHAR PRIMARY KEY,
"hashedPassword" BLOB
username CHAR PRIMARY KEY,
hashedPassword BLOB
);`
)

Expand Down
21 changes: 21 additions & 0 deletions sql/testdata/system
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,27 @@ SELECT id FROM system.descriptor
4
1000

# Verify format of system tables.
query TTT
SHOW COLUMNS FROM system.namespace;
----
parentID INT true
name STRING true
id INT true

query TTT
SHOW COLUMNS FROM system.descriptor;
----
id INT true
descriptor BYTES true

query TTT
SHOW COLUMNS FROM system.users;
----
username STRING true
hashedPassword BYTES true

# Verify default privileges on system tables.
query TTT
SHOW GRANTS ON DATABASE system
----
Expand Down

0 comments on commit 68c5b18

Please sign in to comment.