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)
| 169 | // tables (like there are in the catalog) are sent. |
| 170 | // @see https://github.com/sqlc-dev/sqlc/pull/1748 |
| 171 | func 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 | |
| 188 | func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { |
| 189 | req, ok := args.(protoreflect.ProtoMessage) |