Skip to content

Commit

Permalink
Merge #54982
Browse files Browse the repository at this point in the history
54982: sql: populate owner ID (oid) to pg_database's datdba field r=angelapwen a=angelapwen

Previously this populated as `DNull`. We want to correctly
populate the field to make our ownership logic tests
more robust.

Release note (sql change): Populate the datdba field of
pg_catalog.pg_database. This was previously DNull.


Co-authored-by: angelapwen <angelaw@cockroachlabs.com>
  • Loading branch information
craig[bot] and angelapwen committed Sep 29, 2020
2 parents b864229 + d6bd76a commit 8187c25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pkg/sql/logictest/testdata/logic_test/pg_catalog
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ SELECT oid, datname, datdba, encoding, datcollate, datctype, datistemplate, data
FROM pg_catalog.pg_database
ORDER BY oid
----
oid datname datdba encoding datcollate datctype datistemplate datallowconn
1 system NULL 6 en_US.utf8 en_US.utf8 false true
50 defaultdb NULL 6 en_US.utf8 en_US.utf8 false true
51 postgres NULL 6 en_US.utf8 en_US.utf8 false true
52 test NULL 6 en_US.utf8 en_US.utf8 false true
54 constraint_db NULL 6 en_US.utf8 en_US.utf8 false true
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
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/pg_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ CREATE TABLE pg_catalog.pg_database (
return addRow(
dbOid(db.GetID()), // oid
tree.NewDName(db.GetName()), // datname
tree.DNull, // datdba
getOwnerOID(db), // datdba
// If there is a change in encoding value for the database we must update
// the definitions of getdatabaseencoding within pg_builtin.
builtins.DatEncodingUTFId, // encoding
Expand Down

0 comments on commit 8187c25

Please sign in to comment.