Skip to content

Commit

Permalink
sql: Add pg_description table to pg_catalog
Browse files Browse the repository at this point in the history
The `pg_language` table registers languages in which users can
write functions or stored procedures.

Release note (sql change): Added pg_language table to the pg_catalog.
  • Loading branch information
nvanbenschoten committed Mar 2, 2018
1 parent 9814bb3 commit 837c464
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/sql/logictest/testdata/logic_test/explain
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ sort · ·
└── render · ·
└── filter · ·
└── values · ·
· size 5 columns, 80 rows
· size 5 columns, 81 rows

query TTT
EXPLAIN SHOW DATABASE
Expand Down Expand Up @@ -230,7 +230,7 @@ sort · ·
├── render · ·
│ └── filter · ·
│ └── values · ·
│ size 17 columns, 729 rows
│ size 17 columns, 738 rows
└── render · ·
└── filter · ·
└── values · ·
Expand Down
3 changes: 3 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/information_schema
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ pg_catalog pg_foreign_table
pg_catalog pg_index
pg_catalog pg_indexes
pg_catalog pg_inherits
pg_catalog pg_language
pg_catalog pg_namespace
pg_catalog pg_operator
pg_catalog pg_proc
Expand Down Expand Up @@ -380,6 +381,7 @@ pg_foreign_table
pg_index
pg_indexes
pg_inherits
pg_language
pg_namespace
pg_operator
pg_proc
Expand Down Expand Up @@ -501,6 +503,7 @@ system pg_catalog pg_foreign_table SYSTEM VIE
system pg_catalog pg_index SYSTEM VIEW 1
system pg_catalog pg_indexes SYSTEM VIEW 1
system pg_catalog pg_inherits SYSTEM VIEW 1
system pg_catalog pg_language SYSTEM VIEW 1
system pg_catalog pg_namespace SYSTEM VIEW 1
system pg_catalog pg_operator SYSTEM VIEW 1
system pg_catalog pg_proc SYSTEM VIEW 1
Expand Down
2 changes: 2 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/pg_catalog
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pg_foreign_table
pg_index
pg_indexes
pg_inherits
pg_language
pg_namespace
pg_operator
pg_proc
Expand Down Expand Up @@ -91,6 +92,7 @@ pg_foreign_table
pg_index
pg_indexes
pg_inherits
pg_language
pg_namespace
pg_operator
pg_proc
Expand Down
22 changes: 22 additions & 0 deletions pkg/sql/pg_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ var pgCatalog = virtualSchema{
pgCatalogIndexTable,
pgCatalogIndexesTable,
pgCatalogInheritsTable,
pgCatalogLanguageTable,
pgCatalogNamespaceTable,
pgCatalogOperatorTable,
pgCatalogProcTable,
Expand Down Expand Up @@ -1073,6 +1074,27 @@ CREATE TABLE pg_catalog.pg_inherits (
},
}

// See: https://www.postgresql.org/docs/9.6/static/catalog-pg-language.html.
var pgCatalogLanguageTable = virtualSchemaTable{
schema: `
CREATE TABLE pg_catalog.pg_language (
oid OID,
lanname NAME,
lanowner OID,
lanispl BOOL,
lanpltrusted BOOL,
lanplcallfoid OID,
laninline OID,
lanvalidator OID,
lanacl STRING[]
);
`,
populate: func(_ context.Context, p *planner, _ *DatabaseDescriptor, addRow func(...tree.Datum) error) error {
// Languages to write functions and stored procedures are not supported.
return nil
},
}

// See: https://www.postgresql.org/docs/9.6/static/catalog-pg-namespace.html.
var pgCatalogNamespaceTable = virtualSchemaTable{
schema: `
Expand Down

0 comments on commit 837c464

Please sign in to comment.