-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #422 from dolthub/taylor/schemas-5
Add the rest of the pg_catalog table schemas
- Loading branch information
Showing
12 changed files
with
1,095 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Copyright 2024 Dolthub, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package pgcatalog | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/dolthub/go-mysql-server/sql" | ||
|
||
"github.com/dolthub/doltgresql/server/tables" | ||
pgtypes "github.com/dolthub/doltgresql/server/types" | ||
) | ||
|
||
// PgSubscriptionName is a constant to the pg_subscription name. | ||
const PgSubscriptionName = "pg_subscription" | ||
|
||
// InitPgSubscription handles registration of the pg_subscription handler. | ||
func InitPgSubscription() { | ||
tables.AddHandler(PgCatalogName, PgSubscriptionName, PgSubscriptionHandler{}) | ||
} | ||
|
||
// PgSubscriptionHandler is the handler for the pg_subscription table. | ||
type PgSubscriptionHandler struct{} | ||
|
||
var _ tables.Handler = PgSubscriptionHandler{} | ||
|
||
// Name implements the interface tables.Handler. | ||
func (p PgSubscriptionHandler) Name() string { | ||
return PgSubscriptionName | ||
} | ||
|
||
// RowIter implements the interface tables.Handler. | ||
func (p PgSubscriptionHandler) RowIter(ctx *sql.Context) (sql.RowIter, error) { | ||
// TODO: Implement pg_subscription row iter | ||
return emptyRowIter() | ||
} | ||
|
||
// Schema implements the interface tables.Handler. | ||
func (p PgSubscriptionHandler) Schema() sql.PrimaryKeySchema { | ||
return sql.PrimaryKeySchema{ | ||
Schema: pgSubscriptionSchema, | ||
PkOrdinals: nil, | ||
} | ||
} | ||
|
||
// pgSubscriptionSchema is the schema for pg_subscription. | ||
var pgSubscriptionSchema = sql.Schema{ | ||
{Name: "oid", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgSubscriptionName}, | ||
{Name: "subdbid", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgSubscriptionName}, | ||
{Name: "subskiplsn", Type: pgtypes.Text, Default: nil, Nullable: false, Source: PgSubscriptionName}, // TODO: pg_lsn type | ||
{Name: "subname", Type: pgtypes.Name, Default: nil, Nullable: false, Source: PgSubscriptionName}, | ||
{Name: "subowner", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgSubscriptionName}, | ||
{Name: "subenabled", Type: pgtypes.Bool, Default: nil, Nullable: false, Source: PgSubscriptionName}, | ||
{Name: "subbinary", Type: pgtypes.Bool, Default: nil, Nullable: false, Source: PgSubscriptionName}, | ||
{Name: "substream", Type: pgtypes.Bool, Default: nil, Nullable: false, Source: PgSubscriptionName}, | ||
{Name: "subtwophasestate", Type: pgtypes.BpChar, Default: nil, Nullable: false, Source: PgSubscriptionName}, | ||
{Name: "subdisableonerr", Type: pgtypes.Bool, Default: nil, Nullable: false, Source: PgSubscriptionName}, | ||
{Name: "subconninfo", Type: pgtypes.Text, Default: nil, Nullable: false, Source: PgSubscriptionName}, // TODO: collation C | ||
{Name: "subslotname", Type: pgtypes.Name, Default: nil, Nullable: true, Source: PgSubscriptionName}, | ||
{Name: "subsynccommit", Type: pgtypes.Text, Default: nil, Nullable: false, Source: PgSubscriptionName}, // TODO: collation C | ||
{Name: "subpublications", Type: pgtypes.TextArray, Default: nil, Nullable: false, Source: PgSubscriptionName}, // TODO: collation C | ||
} | ||
|
||
// pgSubscriptionRowIter is the sql.RowIter for the pg_subscription table. | ||
type pgSubscriptionRowIter struct { | ||
} | ||
|
||
var _ sql.RowIter = (*pgSubscriptionRowIter)(nil) | ||
|
||
// Next implements the interface sql.RowIter. | ||
func (iter *pgSubscriptionRowIter) Next(ctx *sql.Context) (sql.Row, error) { | ||
return nil, io.EOF | ||
} | ||
|
||
// Close implements the interface sql.RowIter. | ||
func (iter *pgSubscriptionRowIter) Close(ctx *sql.Context) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright 2024 Dolthub, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package pgcatalog | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/dolthub/go-mysql-server/sql" | ||
|
||
"github.com/dolthub/doltgresql/server/tables" | ||
pgtypes "github.com/dolthub/doltgresql/server/types" | ||
) | ||
|
||
// PgSubscriptionRelName is a constant to the pg_subscription_rel name. | ||
const PgSubscriptionRelName = "pg_subscription_rel" | ||
|
||
// InitPgSubscriptionRel handles registration of the pg_subscription_rel handler. | ||
func InitPgSubscriptionRel() { | ||
tables.AddHandler(PgCatalogName, PgSubscriptionRelName, PgSubscriptionRelHandler{}) | ||
} | ||
|
||
// PgSubscriptionRelHandler is the handler for the pg_subscription_rel table. | ||
type PgSubscriptionRelHandler struct{} | ||
|
||
var _ tables.Handler = PgSubscriptionRelHandler{} | ||
|
||
// Name implements the interface tables.Handler. | ||
func (p PgSubscriptionRelHandler) Name() string { | ||
return PgSubscriptionRelName | ||
} | ||
|
||
// RowIter implements the interface tables.Handler. | ||
func (p PgSubscriptionRelHandler) RowIter(ctx *sql.Context) (sql.RowIter, error) { | ||
// TODO: Implement pg_subscription_rel row iter | ||
return emptyRowIter() | ||
} | ||
|
||
// Schema implements the interface tables.Handler. | ||
func (p PgSubscriptionRelHandler) Schema() sql.PrimaryKeySchema { | ||
return sql.PrimaryKeySchema{ | ||
Schema: pgSubscriptionRelSchema, | ||
PkOrdinals: nil, | ||
} | ||
} | ||
|
||
// pgSubscriptionRelSchema is the schema for pg_subscription_rel. | ||
var pgSubscriptionRelSchema = sql.Schema{ | ||
{Name: "srsubid", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgSubscriptionRelName}, | ||
{Name: "srrelid", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgSubscriptionRelName}, | ||
{Name: "srsubstate", Type: pgtypes.BpChar, Default: nil, Nullable: false, Source: PgSubscriptionRelName}, | ||
{Name: "srsublsn", Type: pgtypes.Text, Default: nil, Nullable: true, Source: PgSubscriptionRelName}, // TODO: pg_lsn type | ||
} | ||
|
||
// pgSubscriptionRelRowIter is the sql.RowIter for the pg_subscription_rel table. | ||
type pgSubscriptionRelRowIter struct { | ||
} | ||
|
||
var _ sql.RowIter = (*pgSubscriptionRelRowIter)(nil) | ||
|
||
// Next implements the interface sql.RowIter. | ||
func (iter *pgSubscriptionRelRowIter) Next(ctx *sql.Context) (sql.Row, error) { | ||
return nil, io.EOF | ||
} | ||
|
||
// Close implements the interface sql.RowIter. | ||
func (iter *pgSubscriptionRelRowIter) Close(ctx *sql.Context) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2024 Dolthub, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package pgcatalog | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/dolthub/go-mysql-server/sql" | ||
|
||
"github.com/dolthub/doltgresql/server/tables" | ||
pgtypes "github.com/dolthub/doltgresql/server/types" | ||
) | ||
|
||
// PgTablespaceName is a constant to the pg_tablespace name. | ||
const PgTablespaceName = "pg_tablespace" | ||
|
||
// InitPgTablespace handles registration of the pg_tablespace handler. | ||
func InitPgTablespace() { | ||
tables.AddHandler(PgCatalogName, PgTablespaceName, PgTablespaceHandler{}) | ||
} | ||
|
||
// PgTablespaceHandler is the handler for the pg_tablespace table. | ||
type PgTablespaceHandler struct{} | ||
|
||
var _ tables.Handler = PgTablespaceHandler{} | ||
|
||
// Name implements the interface tables.Handler. | ||
func (p PgTablespaceHandler) Name() string { | ||
return PgTablespaceName | ||
} | ||
|
||
// RowIter implements the interface tables.Handler. | ||
func (p PgTablespaceHandler) RowIter(ctx *sql.Context) (sql.RowIter, error) { | ||
// TODO: Implement pg_tablespace row iter | ||
return emptyRowIter() | ||
} | ||
|
||
// Schema implements the interface tables.Handler. | ||
func (p PgTablespaceHandler) Schema() sql.PrimaryKeySchema { | ||
return sql.PrimaryKeySchema{ | ||
Schema: pgTablespaceSchema, | ||
PkOrdinals: nil, | ||
} | ||
} | ||
|
||
// pgTablespaceSchema is the schema for pg_tablespace. | ||
var pgTablespaceSchema = sql.Schema{ | ||
{Name: "oid", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgTablespaceName}, | ||
{Name: "spcname", Type: pgtypes.Name, Default: nil, Nullable: false, Source: PgTablespaceName}, | ||
{Name: "spcowner", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgTablespaceName}, | ||
{Name: "spcacl", Type: pgtypes.TextArray, Default: nil, Nullable: true, Source: PgTablespaceName}, // TODO: aclitem[] type | ||
{Name: "spcoptions", Type: pgtypes.TextArray, Default: nil, Nullable: true, Source: PgTablespaceName}, // TODO: collation C | ||
} | ||
|
||
// pgTablespaceRowIter is the sql.RowIter for the pg_tablespace table. | ||
type pgTablespaceRowIter struct { | ||
} | ||
|
||
var _ sql.RowIter = (*pgTablespaceRowIter)(nil) | ||
|
||
// Next implements the interface sql.RowIter. | ||
func (iter *pgTablespaceRowIter) Next(ctx *sql.Context) (sql.Row, error) { | ||
return nil, io.EOF | ||
} | ||
|
||
// Close implements the interface sql.RowIter. | ||
func (iter *pgTablespaceRowIter) Close(ctx *sql.Context) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2024 Dolthub, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package pgcatalog | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/dolthub/go-mysql-server/sql" | ||
|
||
"github.com/dolthub/doltgresql/server/tables" | ||
pgtypes "github.com/dolthub/doltgresql/server/types" | ||
) | ||
|
||
// PgTransformName is a constant to the pg_transform name. | ||
const PgTransformName = "pg_transform" | ||
|
||
// InitPgTransform handles registration of the pg_transform handler. | ||
func InitPgTransform() { | ||
tables.AddHandler(PgCatalogName, PgTransformName, PgTransformHandler{}) | ||
} | ||
|
||
// PgTransformHandler is the handler for the pg_transform table. | ||
type PgTransformHandler struct{} | ||
|
||
var _ tables.Handler = PgTransformHandler{} | ||
|
||
// Name implements the interface tables.Handler. | ||
func (p PgTransformHandler) Name() string { | ||
return PgTransformName | ||
} | ||
|
||
// RowIter implements the interface tables.Handler. | ||
func (p PgTransformHandler) RowIter(ctx *sql.Context) (sql.RowIter, error) { | ||
// TODO: Implement pg_transform row iter | ||
return emptyRowIter() | ||
} | ||
|
||
// Schema implements the interface tables.Handler. | ||
func (p PgTransformHandler) Schema() sql.PrimaryKeySchema { | ||
return sql.PrimaryKeySchema{ | ||
Schema: pgTransformSchema, | ||
PkOrdinals: nil, | ||
} | ||
} | ||
|
||
// pgTransformSchema is the schema for pg_transform. | ||
var pgTransformSchema = sql.Schema{ | ||
{Name: "oid", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgTransformName}, | ||
{Name: "trftype", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgTransformName}, | ||
{Name: "trflang", Type: pgtypes.Oid, Default: nil, Nullable: false, Source: PgTransformName}, | ||
{Name: "trffromsql", Type: pgtypes.Text, Default: nil, Nullable: false, Source: PgTransformName}, // TODO: regproc type | ||
{Name: "trftosql", Type: pgtypes.Text, Default: nil, Nullable: false, Source: PgTransformName}, // TODO: regproc type | ||
} | ||
|
||
// pgTransformRowIter is the sql.RowIter for the pg_transform table. | ||
type pgTransformRowIter struct { | ||
} | ||
|
||
var _ sql.RowIter = (*pgTransformRowIter)(nil) | ||
|
||
// Next implements the interface sql.RowIter. | ||
func (iter *pgTransformRowIter) Next(ctx *sql.Context) (sql.Row, error) { | ||
return nil, io.EOF | ||
} | ||
|
||
// Close implements the interface sql.RowIter. | ||
func (iter *pgTransformRowIter) Close(ctx *sql.Context) error { | ||
return nil | ||
} |
Oops, something went wrong.