MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / removePGCatalog

Function removePGCatalog

internal/ext/wasm/wasm.go:171–186  ·  view source on GitHub ↗

removePGCatalog removes the pg_catalog schema from the request. There is a mysterious (reason unknown) bug with wasm plugins when a large amount of tables (like there are in the catalog) are sent. @see https://github.com/sqlc-dev/sqlc/pull/1748

(req *plugin.GenerateRequest)

Source from the content-addressed store, hash-verified

169// tables (like there are in the catalog) are sent.
170// @see https://github.com/sqlc-dev/sqlc/pull/1748
171func removePGCatalog(req *plugin.GenerateRequest) {
172 if req.Catalog == nil || req.Catalog.Schemas == nil {
173 return
174 }
175
176 filtered := make([]*plugin.Schema, 0, len(req.Catalog.Schemas))
177 for _, schema := range req.Catalog.Schemas {
178 if schema.Name == "pg_catalog" || schema.Name == "information_schema" {
179 continue
180 }
181
182 filtered = append(filtered, schema)
183 }
184
185 req.Catalog.Schemas = filtered
186}
187
188func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error {
189 req, ok := args.(protoreflect.ProtoMessage)

Callers 1

InvokeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected