diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index 654500429a..dd0da1eea1 100644 --- a/internal/cmd/shim.go +++ b/internal/cmd/shim.go @@ -115,6 +115,7 @@ func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { }, Columns: columns, Comment: t.Comment, + Hidden: t.Hidden, }) } schemas = append(schemas, &plugin.Schema{ diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index 515d0a654f..496507df5c 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -68,6 +68,9 @@ func buildStructs(req *plugin.GenerateRequest, options *opts.Options) []Struct { } for _, table := range schema.Tables { var tableName string + if table.Hidden { + continue + } if schema.Name == req.Catalog.DefaultSchema { tableName = table.Rel.Name } else { diff --git a/internal/compiler/output_columns.go b/internal/compiler/output_columns.go index b0a15e6ac4..4e9c8b02d2 100644 --- a/internal/compiler/output_columns.go +++ b/internal/compiler/output_columns.go @@ -3,6 +3,7 @@ package compiler import ( "errors" "fmt" + "math/rand" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" @@ -596,16 +597,14 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro if err != nil { return nil, err } - - var tableName string - if n.Alias != nil { - tableName = *n.Alias.Aliasname + rel := &ast.TableName{} + if n.Alias != nil && n.Alias.Aliasname != nil { + rel.Name = *n.Alias.Aliasname + } else { + rel.Name = fmt.Sprintf("unnamed_subquery_%d", rand.Int63()) } - tables = append(tables, &Table{ - Rel: &ast.TableName{ - Name: tableName, - }, + Rel: rel, Columns: cols, }) diff --git a/internal/compiler/query_catalog.go b/internal/compiler/query_catalog.go index 80b59d876c..29abace6e2 100644 --- a/internal/compiler/query_catalog.go +++ b/internal/compiler/query_catalog.go @@ -2,6 +2,7 @@ package compiler import ( "fmt" + "math/rand" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/catalog" @@ -9,13 +10,15 @@ import ( ) type QueryCatalog struct { - catalog *catalog.Catalog - ctes map[string]*Table - embeds rewrite.EmbedSet + catalog *catalog.Catalog + ctes map[string]*Table + fromClauses map[string]*Table + embeds rewrite.EmbedSet } func (comp *Compiler) buildQueryCatalog(c *catalog.Catalog, node ast.Node, embeds rewrite.EmbedSet) (*QueryCatalog, error) { var with *ast.WithClause + var from *ast.List switch n := node.(type) { case *ast.DeleteStmt: with = n.WithClause @@ -23,12 +26,20 @@ func (comp *Compiler) buildQueryCatalog(c *catalog.Catalog, node ast.Node, embed with = n.WithClause case *ast.UpdateStmt: with = n.WithClause + from = n.FromClause case *ast.SelectStmt: with = n.WithClause + from = n.FromClause default: with = nil + from = nil + } + qc := &QueryCatalog{ + catalog: c, + ctes: map[string]*Table{}, + fromClauses: map[string]*Table{}, + embeds: embeds, } - qc := &QueryCatalog{catalog: c, ctes: map[string]*Table{}, embeds: embeds} if with != nil { for _, item := range with.Ctes.Items { if cte, ok := item.(*ast.CommonTableExpr); ok { @@ -60,6 +71,42 @@ func (comp *Compiler) buildQueryCatalog(c *catalog.Catalog, node ast.Node, embed } } } + if from != nil { + for _, item := range from.Items { + if rs, ok := item.(*ast.RangeSubselect); ok { + cols, err := comp.outputColumns(qc, rs.Subquery) + if err != nil { + return nil, err + } + var names []string + if rs.Alias != nil && rs.Alias.Colnames != nil { + for _, item := range rs.Alias.Colnames.Items { + if val, ok := item.(*ast.String); ok { + names = append(names, val.Str) + } else { + names = append(names, "") + } + } + } + rel := &ast.TableName{} + if rs.Alias != nil && rs.Alias.Aliasname != nil { + rel.Name = *rs.Alias.Aliasname + } else { + rel.Name = fmt.Sprintf("unaliased_table_%d", rand.Int63()) + } + for i := range cols { + cols[i].Table = rel + if len(names) > i { + cols[i].Name = names[i] + } + } + qc.fromClauses[rel.Name] = &Table{ + Rel: rel, + Columns: cols, + } + } + } + } return qc, nil } diff --git a/internal/compiler/resolve.go b/internal/compiler/resolve.go index b1fbb1990e..25c78340bf 100644 --- a/internal/compiler/resolve.go +++ b/internal/compiler/resolve.go @@ -67,7 +67,38 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, continue } // If the table name doesn't exist, first check if it's a CTE - if _, qcerr := qc.GetTable(fqn); qcerr != nil { + catTable, qcerr := qc.GetTable(fqn) + if qcerr != nil { + return nil, err + } + + // If it's a CTE, add it to the alias map and add its columns to + // the type map. This is to allow us to resolve references to the + // CTE's columns in a query. + aliasMap[fqn.Name] = fqn + if rv.Alias != nil { + aliasMap[*rv.Alias.Aliasname] = fqn + } + + catCols := make([]*catalog.Column, 0, len(catTable.Columns)) + for _, col := range catTable.Columns { + catCols = append(catCols, &catalog.Column{ + Name: col.Name, + Type: ast.TypeName{Name: col.DataType}, + IsNotNull: col.NotNull, + IsUnsigned: col.Unsigned, + IsArray: col.IsArray, + ArrayDims: col.ArrayDims, + Comment: col.Comment, + Length: col.Length, + }) + } + + err = indexTable(catalog.Table{ + Rel: catTable.Rel, + Columns: catCols, + }) + if err != nil { return nil, err } continue @@ -80,6 +111,30 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, aliasMap[*rv.Alias.Aliasname] = fqn } } + if qc != nil { + for _, f := range qc.fromClauses { + catCols := make([]*catalog.Column, 0, len(f.Columns)) + for _, col := range f.Columns { + catCols = append(catCols, &catalog.Column{ + Name: col.Name, + Type: ast.TypeName{Name: col.DataType}, + IsNotNull: col.NotNull, + IsUnsigned: col.Unsigned, + IsArray: col.IsArray, + ArrayDims: col.ArrayDims, + Comment: col.Comment, + Length: col.Length, + }) + } + + if err := indexTable(catalog.Table{ + Rel: f.Rel, + Columns: catCols, + }); err != nil { + return nil, err + } + } + } // resolve a table for an embed for _, embed := range embeds { diff --git a/internal/endtoend/testdata/codegen_json/gen/codegen.json b/internal/endtoend/testdata/codegen_json/gen/codegen.json index 754d2af289..55d5ed0ec0 100644 --- a/internal/endtoend/testdata/codegen_json/gen/codegen.json +++ b/internal/endtoend/testdata/codegen_json/gen/codegen.json @@ -112,7 +112,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false } ], "enums": [], @@ -865,7 +866,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -1135,7 +1137,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -1535,7 +1538,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -1857,7 +1861,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -2127,7 +2132,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -2969,7 +2975,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -3239,7 +3246,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -3717,7 +3725,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -3961,7 +3970,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -4075,7 +4085,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -4319,7 +4330,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -4641,7 +4653,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -5665,7 +5678,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -6117,7 +6131,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -6179,7 +6194,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -7021,7 +7037,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -7395,7 +7412,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -7561,7 +7579,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -8143,7 +8162,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -8387,7 +8407,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -8683,7 +8704,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -9031,7 +9053,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -9301,7 +9324,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -9571,7 +9595,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -9919,7 +9944,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -10293,7 +10319,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -10485,7 +10512,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -10833,7 +10861,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11207,7 +11236,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11451,7 +11481,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11539,7 +11570,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11783,7 +11815,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11923,7 +11956,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -12635,7 +12669,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -12775,7 +12810,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -13045,7 +13081,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -13341,7 +13378,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -13741,7 +13779,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -13985,7 +14024,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -14229,7 +14269,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -14655,7 +14696,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -14847,7 +14889,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -15117,7 +15160,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -15517,7 +15561,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -16073,7 +16118,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -16369,7 +16415,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -16613,7 +16660,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -16987,7 +17035,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -17205,7 +17254,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -17579,7 +17629,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -17771,7 +17822,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -17911,7 +17963,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -18857,7 +18910,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -19257,7 +19311,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -19501,7 +19556,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -19797,7 +19853,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -19937,7 +19994,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -20285,7 +20343,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -20503,7 +20562,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -20617,7 +20677,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -21017,7 +21078,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -21391,7 +21453,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -21739,7 +21802,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -21853,7 +21917,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -22149,7 +22214,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -22367,7 +22433,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -22741,7 +22808,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -23037,7 +23105,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -23489,7 +23558,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -23733,7 +23803,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -24081,7 +24152,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -24325,7 +24397,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -24439,7 +24512,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -24709,7 +24783,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -25291,7 +25366,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -25509,7 +25585,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -26117,7 +26194,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -26309,7 +26387,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -26605,7 +26684,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -27343,7 +27423,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -27535,7 +27616,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -27649,7 +27731,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -27971,7 +28054,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -28137,7 +28221,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -28459,7 +28544,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -28729,7 +28815,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -29155,7 +29242,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -29451,7 +29539,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -29721,7 +29810,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -30251,7 +30341,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -30521,7 +30612,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -30765,7 +30857,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -30983,7 +31076,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -31227,7 +31321,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -31367,7 +31462,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -31585,7 +31681,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -32193,7 +32290,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -32359,7 +32457,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -32577,7 +32676,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -33185,7 +33285,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -33429,7 +33530,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -33829,7 +33931,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -34125,7 +34228,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -34421,7 +34525,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -34587,7 +34692,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -34883,7 +34989,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35075,7 +35182,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35215,7 +35323,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35511,7 +35620,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35703,7 +35813,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35843,7 +35954,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -36139,7 +36251,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -36331,7 +36444,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -36471,7 +36585,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -36767,7 +36882,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -37739,7 +37855,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -38139,7 +38256,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -38461,7 +38579,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -38835,7 +38954,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -39235,7 +39355,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -39687,7 +39808,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -40217,7 +40339,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -40487,7 +40610,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -40705,7 +40829,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -41001,7 +41126,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -41089,7 +41215,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -41203,7 +41330,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -41499,7 +41627,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -42159,7 +42288,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -42455,7 +42585,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -42725,7 +42856,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -43047,7 +43179,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -43421,7 +43554,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -43717,7 +43851,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -44715,7 +44850,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -44959,7 +45095,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -45229,7 +45366,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -45395,7 +45533,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -45509,7 +45648,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false } ], "enums": [], @@ -45709,7 +45849,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -45953,7 +46094,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46067,7 +46209,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46259,7 +46402,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46451,7 +46595,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46539,7 +46684,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46627,7 +46773,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -47443,7 +47590,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -47661,7 +47809,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -47827,7 +47976,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -47941,7 +48091,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48107,7 +48258,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48221,7 +48373,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48361,7 +48514,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48553,7 +48707,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48719,7 +48874,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48937,7 +49093,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -49129,7 +49286,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -50283,7 +50441,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -50475,7 +50634,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -50641,7 +50801,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -50781,7 +50942,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -50999,7 +51161,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -51165,7 +51328,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -51877,7 +52041,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -52641,7 +52806,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -52677,7 +52843,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -52791,7 +52958,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -52931,7 +53099,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53045,7 +53214,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53237,7 +53407,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53377,7 +53548,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53517,7 +53689,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53553,7 +53726,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53797,7 +53971,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -54639,7 +54814,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -54883,7 +55059,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -55101,7 +55278,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -55371,7 +55549,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -55589,7 +55768,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -55781,7 +55961,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -55999,7 +56180,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -56269,7 +56451,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -56539,7 +56722,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -56705,7 +56889,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -56949,7 +57134,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -57193,7 +57379,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -59335,7 +59522,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -59527,7 +59715,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -59849,7 +60038,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -60197,7 +60387,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -60493,7 +60684,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -60789,7 +60981,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -61059,7 +61252,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -61355,7 +61549,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -61573,7 +61768,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -61895,7 +62091,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -62113,7 +62310,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -62305,7 +62503,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -62757,7 +62956,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -62949,7 +63149,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -63167,7 +63368,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -63931,7 +64133,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64071,7 +64274,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64159,7 +64363,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64351,7 +64556,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64517,7 +64723,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64683,7 +64890,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64953,7 +65161,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false } ], "enums": [], diff --git a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go index 564b33b190..4c087d16df 100644 --- a/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_left_join/postgresql/pgx/go/query.sql.go @@ -7,8 +7,6 @@ package querytest import ( "context" - - "github.com/jackc/pgx/v5/pgtype" ) const badQuery = `-- name: BadQuery :exec @@ -28,7 +26,7 @@ FROM WHERE c1.name = $1 ` -func (q *Queries) BadQuery(ctx context.Context, dollar_1 pgtype.Text) error { - _, err := q.db.Exec(ctx, badQuery, dollar_1) +func (q *Queries) BadQuery(ctx context.Context, name string) error { + _, err := q.db.Exec(ctx, badQuery, name) return err } diff --git a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go index 690a024aed..3e13d77879 100644 --- a/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_recursive_union/postgresql/pgx/go/query.sql.go @@ -7,8 +7,6 @@ package querytest import ( "context" - - "github.com/jackc/pgx/v5/pgtype" ) const listCaseIntentHistory = `-- name: ListCaseIntentHistory :many @@ -36,7 +34,7 @@ type ListCaseIntentHistoryRow struct { Group string } -func (q *Queries) ListCaseIntentHistory(ctx context.Context, caseIntentID pgtype.Int8) ([]ListCaseIntentHistoryRow, error) { +func (q *Queries) ListCaseIntentHistory(ctx context.Context, caseIntentID int64) ([]ListCaseIntentHistoryRow, error) { rows, err := q.db.Query(ctx, listCaseIntentHistory, caseIntentID) if err != nil { return nil, err diff --git a/internal/endtoend/testdata/cte_resolve_ref/issue.md b/internal/endtoend/testdata/cte_resolve_ref/issue.md new file mode 100644 index 0000000000..9268a7d1f8 --- /dev/null +++ b/internal/endtoend/testdata/cte_resolve_ref/issue.md @@ -0,0 +1,2 @@ +https://github.com/sqlc-dev/sqlc/issues/3219 + diff --git a/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/go/db.go b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/go/db.go new file mode 100644 index 0000000000..7c111fd4e7 --- /dev/null +++ b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/go/db.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.26.0 + +package querytest + +import ( + "context" + + "github.com/jackc/pgx/v5" + "github.com/jackc/pgx/v5/pgconn" +) + +type DBTX interface { + Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) + Query(context.Context, string, ...interface{}) (pgx.Rows, error) + QueryRow(context.Context, string, ...interface{}) pgx.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx pgx.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/go/models.go b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/go/models.go new file mode 100644 index 0000000000..9099b926b3 --- /dev/null +++ b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/go/models.go @@ -0,0 +1,13 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.26.0 + +package querytest + +type T1 struct { + ID int32 +} + +type T2 struct { + ID int32 +} diff --git a/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/go/query.sql.go new file mode 100644 index 0000000000..d4fb8b9c5f --- /dev/null +++ b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/go/query.sql.go @@ -0,0 +1,44 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.26.0 +// source: query.sql + +package querytest + +import ( + "context" +) + +const cTEMultipleRefs = `-- name: CTEMultipleRefs :one +WITH t1_ids AS ( + SELECT id FROM t1 WHERE t1.id = $1 +), +t2_ids AS ( + SELECT id FROM t2 WHERE t2.id = $1 +), +all_ids AS ( + SELECT id FROM t1_ids + UNION + SELECT id FROM t2_ids +) +SELECT id FROM all_ids AS ids WHERE ids.id = $1 +` + +func (q *Queries) CTEMultipleRefs(ctx context.Context, id int32) (int32, error) { + row := q.db.QueryRow(ctx, cTEMultipleRefs, id) + err := row.Scan(&id) + return id, err +} + +const cTERef = `-- name: CTERef :one +WITH t1_ids AS ( + SELECT id FROM t1 +) +SELECT id FROM t1_ids WHERE t1_ids.id = $1 +` + +func (q *Queries) CTERef(ctx context.Context, id int32) (int32, error) { + row := q.db.QueryRow(ctx, cTERef, id) + err := row.Scan(&id) + return id, err +} diff --git a/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/query.sql b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/query.sql new file mode 100644 index 0000000000..39c87dfc31 --- /dev/null +++ b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/query.sql @@ -0,0 +1,21 @@ +-- name: CTERef :one +WITH t1_ids AS ( + SELECT id FROM t1 +) +SELECT * FROM t1_ids WHERE t1_ids.id = sqlc.arg('id'); + +-- name: CTEMultipleRefs :one +WITH t1_ids AS ( + SELECT id FROM t1 WHERE t1.id = sqlc.arg('id') +), +t2_ids AS ( + SELECT id FROM t2 WHERE t2.id = sqlc.arg('id') +), +all_ids AS ( + SELECT * FROM t1_ids + UNION + SELECT * FROM t2_ids +) +SELECT * FROM all_ids AS ids WHERE ids.id = sqlc.arg('id'); + + diff --git a/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/schema.sql b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/schema.sql new file mode 100644 index 0000000000..3029ac89be --- /dev/null +++ b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/schema.sql @@ -0,0 +1,9 @@ +CREATE TABLE t1 +( + id SERIAL NOT NULL PRIMARY KEY +); + +CREATE TABLE t2 +( + id SERIAL NOT NULL PRIMARY KEY +); diff --git a/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/sqlc.yaml b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/sqlc.yaml new file mode 100644 index 0000000000..01489e0ffc --- /dev/null +++ b/internal/endtoend/testdata/cte_resolve_ref/postgresql/pgx/sqlc.yaml @@ -0,0 +1,10 @@ +version: "2" +sql: + - engine: "postgresql" + schema: "schema.sql" + queries: "query.sql" + gen: + go: + package: "querytest" + out: "go" + sql_package: "pgx/v5" \ No newline at end of file diff --git a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go index 61ba601b90..8e8ff6238b 100644 --- a/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/cte_update/postgresql/pgx/go/query.sql.go @@ -23,9 +23,9 @@ from updated_attribute ` type UpdateAttributeParams struct { - FilterValue pgtype.Bool - Value pgtype.Text - ID pgtype.Int8 + FilterValue bool + Value string + ID int64 } type UpdateAttributeRow struct { diff --git a/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go b/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go index 932153ec78..09fa93ed81 100644 --- a/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_alias/mysql/go/query.sql.go @@ -80,3 +80,84 @@ func (q *Queries) AliasJoin(ctx context.Context, id uint64) ([]AliasJoinRow, err } return items, nil } + +const columnAlias = `-- name: ColumnAlias :many +SELECT n FROM (SELECT 1 AS n) WHERE n <= ? +` + +func (q *Queries) ColumnAlias(ctx context.Context, n int32) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, columnAlias, n) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var n int32 + if err := rows.Scan(&n); err != nil { + return nil, err + } + items = append(items, n) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const columnAndQueryAlias = `-- name: ColumnAndQueryAlias :many +SELECT n FROM (SELECT 1 AS n) AS x WHERE n <= ? +` + +func (q *Queries) ColumnAndQueryAlias(ctx context.Context, n int32) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, columnAndQueryAlias, n) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var n int32 + if err := rows.Scan(&n); err != nil { + return nil, err + } + items = append(items, n) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const subqueryAlias = `-- name: SubqueryAlias :many +SELECT n FROM (SELECT 1 AS n) AS x WHERE x.n <= ? +` + +func (q *Queries) SubqueryAlias(ctx context.Context, n int32) ([]int32, error) { + rows, err := q.db.QueryContext(ctx, subqueryAlias, n) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var n int32 + if err := rows.Scan(&n); err != nil { + return nil, err + } + items = append(items, n) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/join_alias/mysql/query.sql b/internal/endtoend/testdata/join_alias/mysql/query.sql index 9b087bcae7..77ed3cd3ad 100644 --- a/internal/endtoend/testdata/join_alias/mysql/query.sql +++ b/internal/endtoend/testdata/join_alias/mysql/query.sql @@ -9,3 +9,12 @@ SELECT * FROM foo f JOIN bar b ON b.id = f.id WHERE f.id = ?; + +-- name: SubqueryAlias :many +SELECT * FROM (SELECT 1 AS n) AS x WHERE x.n <= ?; + +-- name: ColumnAlias :many +SELECT * FROM (SELECT 1 AS n) WHERE n <= ?; + +-- name: ColumnAndQueryAlias :many +SELECT * FROM (SELECT 1 AS n) AS x WHERE n <= ?; diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json index 0c7282ac9c..2b8d0963c3 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json @@ -114,7 +114,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false } ], "enums": [], @@ -867,7 +868,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -1137,7 +1139,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -1537,7 +1540,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -1859,7 +1863,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -2129,7 +2134,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -2971,7 +2977,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -3241,7 +3248,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -3719,7 +3727,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -3963,7 +3972,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -4077,7 +4087,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -4321,7 +4332,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -4643,7 +4655,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -5667,7 +5680,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -6119,7 +6133,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -6181,7 +6196,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -7023,7 +7039,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -7397,7 +7414,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -7563,7 +7581,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -8145,7 +8164,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -8389,7 +8409,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -8685,7 +8706,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -9033,7 +9055,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -9303,7 +9326,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -9573,7 +9597,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -9921,7 +9946,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -10295,7 +10321,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -10487,7 +10514,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -10835,7 +10863,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11209,7 +11238,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11453,7 +11483,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11541,7 +11572,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11785,7 +11817,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -11925,7 +11958,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -12637,7 +12671,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -12777,7 +12812,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -13047,7 +13083,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -13343,7 +13380,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -13743,7 +13781,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -13987,7 +14026,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -14231,7 +14271,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -14657,7 +14698,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -14849,7 +14891,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -15119,7 +15162,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -15519,7 +15563,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -16075,7 +16120,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -16371,7 +16417,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -16615,7 +16662,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -16989,7 +17037,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -17207,7 +17256,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -17581,7 +17631,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -17773,7 +17824,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -17913,7 +17965,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -18859,7 +18912,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -19259,7 +19313,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -19503,7 +19558,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -19799,7 +19855,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -19939,7 +19996,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -20287,7 +20345,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -20505,7 +20564,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -20619,7 +20679,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -21019,7 +21080,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -21393,7 +21455,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -21741,7 +21804,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -21855,7 +21919,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -22151,7 +22216,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -22369,7 +22435,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -22743,7 +22810,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -23039,7 +23107,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -23491,7 +23560,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -23735,7 +23805,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -24083,7 +24154,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -24327,7 +24399,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -24441,7 +24514,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -24711,7 +24785,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -25293,7 +25368,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -25511,7 +25587,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -26119,7 +26196,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -26311,7 +26389,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -26607,7 +26686,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -27345,7 +27425,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -27537,7 +27618,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -27651,7 +27733,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -27973,7 +28056,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -28139,7 +28223,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -28461,7 +28546,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -28731,7 +28817,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -29157,7 +29244,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -29453,7 +29541,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -29723,7 +29812,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -30253,7 +30343,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -30523,7 +30614,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -30767,7 +30859,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -30985,7 +31078,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -31229,7 +31323,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -31369,7 +31464,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -31587,7 +31683,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -32195,7 +32292,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -32361,7 +32459,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -32579,7 +32678,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -33187,7 +33287,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -33431,7 +33532,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -33831,7 +33933,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -34127,7 +34230,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -34423,7 +34527,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -34589,7 +34694,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -34885,7 +34991,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35077,7 +35184,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35217,7 +35325,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35513,7 +35622,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35705,7 +35815,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -35845,7 +35956,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -36141,7 +36253,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -36333,7 +36446,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -36473,7 +36587,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -36769,7 +36884,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -37741,7 +37857,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -38141,7 +38258,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -38463,7 +38581,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -38837,7 +38956,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -39237,7 +39357,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -39689,7 +39810,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -40219,7 +40341,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -40489,7 +40612,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -40707,7 +40831,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -41003,7 +41128,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -41091,7 +41217,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -41205,7 +41332,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -41501,7 +41629,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -42161,7 +42290,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -42457,7 +42587,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -42727,7 +42858,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -43049,7 +43181,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -43423,7 +43556,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -43719,7 +43853,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -44717,7 +44852,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -44961,7 +45097,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -45231,7 +45368,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -45397,7 +45535,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -45511,7 +45650,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false } ], "enums": [], @@ -45711,7 +45851,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -45955,7 +46096,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46069,7 +46211,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46261,7 +46404,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46453,7 +46597,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46541,7 +46686,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -46629,7 +46775,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -47445,7 +47592,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -47663,7 +47811,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -47829,7 +47978,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -47943,7 +48093,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48109,7 +48260,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48223,7 +48375,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48363,7 +48516,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48555,7 +48709,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48721,7 +48876,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -48939,7 +49095,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -49131,7 +49288,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -50285,7 +50443,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -50477,7 +50636,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -50643,7 +50803,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -50783,7 +50944,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -51001,7 +51163,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -51167,7 +51330,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -51879,7 +52043,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -52643,7 +52808,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -52679,7 +52845,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -52793,7 +52960,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -52933,7 +53101,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53047,7 +53216,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53239,7 +53409,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53379,7 +53550,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53519,7 +53691,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53555,7 +53728,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -53799,7 +53973,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -54641,7 +54816,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -54885,7 +55061,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -55103,7 +55280,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -55373,7 +55551,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -55591,7 +55770,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -55783,7 +55963,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -56001,7 +56182,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -56271,7 +56453,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -56541,7 +56724,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -56707,7 +56891,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -56951,7 +57136,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -57195,7 +57381,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -59337,7 +59524,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -59529,7 +59717,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -59851,7 +60040,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -60199,7 +60389,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -60495,7 +60686,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -60791,7 +60983,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -61061,7 +61254,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -61357,7 +61551,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -61575,7 +61770,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -61897,7 +62093,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -62115,7 +62312,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -62307,7 +62505,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -62759,7 +62958,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -62951,7 +63151,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -63169,7 +63370,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -63933,7 +64135,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64073,7 +64276,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64161,7 +64365,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64353,7 +64558,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64519,7 +64725,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64685,7 +64892,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false }, { "rel": { @@ -64955,7 +65163,8 @@ "array_dims": 0 } ], - "comment": "" + "comment": "", + "hidden": false } ], "enums": [], diff --git a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go index 9510db3a68..e90054f807 100644 --- a/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go +++ b/internal/endtoend/testdata/select_subquery_alias/postgresql/pgx/go/query.sql.go @@ -24,8 +24,8 @@ where amounts.last_balance < $2 ` type FindWalletsParams struct { - Column1 pgtype.Text - Column2 pgtype.Numeric + Type string + LastBalance pgtype.Numeric } type FindWalletsRow struct { @@ -36,7 +36,7 @@ type FindWalletsRow struct { } func (q *Queries) FindWallets(ctx context.Context, arg FindWalletsParams) ([]FindWalletsRow, error) { - rows, err := q.db.Query(ctx, findWallets, arg.Column1, arg.Column2) + rows, err := q.db.Query(ctx, findWallets, arg.Type, arg.LastBalance) if err != nil { return nil, err } diff --git a/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go b/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go index b4f04af9a0..43c2a22510 100644 --- a/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/table_function/sqlite/go/query.sql.go @@ -57,3 +57,52 @@ func (q *Queries) GetTransaction(ctx context.Context, arg GetTransactionParams) } return items, nil } + +const getTransactionWithoutAlias = `-- name: GetTransactionWithoutAlias :many +SELECT + json_extract(transactions.data, '$.transaction.signatures[0]'), + json_group_array(value) +FROM + transactions, + json_each(json_extract(transactions.data, '$.transaction.message.instructions')) +WHERE + transactions.program_id = ? + AND json_extract(transactions.data, '$.transaction.signatures[0]') > ? + AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(value, '$.programIdIndex') || ']') = transactions.program_id +GROUP BY transactions.rowid +LIMIT ? +` + +type GetTransactionWithoutAliasParams struct { + ProgramID string + Data string + Limit int64 +} + +type GetTransactionWithoutAliasRow struct { + JsonExtract interface{} + JsonGroupArray interface{} +} + +func (q *Queries) GetTransactionWithoutAlias(ctx context.Context, arg GetTransactionWithoutAliasParams) ([]GetTransactionWithoutAliasRow, error) { + rows, err := q.db.QueryContext(ctx, getTransactionWithoutAlias, arg.ProgramID, arg.Data, arg.Limit) + if err != nil { + return nil, err + } + defer rows.Close() + var items []GetTransactionWithoutAliasRow + for rows.Next() { + var i GetTransactionWithoutAliasRow + if err := rows.Scan(&i.JsonExtract, &i.JsonGroupArray); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} diff --git a/internal/endtoend/testdata/table_function/sqlite/query.sql b/internal/endtoend/testdata/table_function/sqlite/query.sql index 867e1114cb..f174303538 100644 --- a/internal/endtoend/testdata/table_function/sqlite/query.sql +++ b/internal/endtoend/testdata/table_function/sqlite/query.sql @@ -11,3 +11,17 @@ WHERE AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id GROUP BY transactions.rowid LIMIT ?; + +/* name: GetTransactionWithoutAlias :many */ +SELECT + json_extract(transactions.data, '$.transaction.signatures[0]'), + json_group_array(value) +FROM + transactions, + json_each(json_extract(transactions.data, '$.transaction.message.instructions')) +WHERE + transactions.program_id = ? + AND json_extract(transactions.data, '$.transaction.signatures[0]') > ? + AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(value, '$.programIdIndex') || ']') = transactions.program_id +GROUP BY transactions.rowid +LIMIT ?; \ No newline at end of file diff --git a/internal/engine/sqlite/convert.go b/internal/engine/sqlite/convert.go index 658a9d7f33..59b17b56c0 100644 --- a/internal/engine/sqlite/convert.go +++ b/internal/engine/sqlite/convert.go @@ -195,12 +195,18 @@ func (c *cc) convertCreate_view_stmtContext(n *parser.Create_view_stmtContext) a type Delete_stmt interface { node + With_clause() parser.IWith_clauseContext Qualified_table_name() parser.IQualified_table_nameContext WHERE_() antlr.TerminalNode Expr() parser.IExprContext } func (c *cc) convertDelete_stmtContext(n Delete_stmt) ast.Node { + var withClause *ast.WithClause + if w := n.With_clause(); w != nil { + withClause = c.convertWithClause(w) + } + if qualifiedName, ok := n.Qualified_table_name().(*parser.Qualified_table_nameContext); ok { tableName := identifier(qualifiedName.Table_name().GetText()) @@ -223,8 +229,8 @@ func (c *cc) convertDelete_stmtContext(n Delete_stmt) ast.Node { relations.Items = append(relations.Items, relation) delete := &ast.DeleteStmt{ + WithClause: withClause, Relations: relations, - WithClause: nil, } if n.WHERE_() != nil && n.Expr() != nil { @@ -854,6 +860,11 @@ func (c *cc) convertReturning_caluseContext(n parser.IReturning_clauseContext) * } func (c *cc) convertInsert_stmtContext(n *parser.Insert_stmtContext) ast.Node { + var withClause *ast.WithClause + if w := n.With_clause(); w != nil { + withClause = c.convertWithClause(w) + } + tableName := identifier(n.Table_name().GetText()) rel := &ast.RangeVar{ Relname: &tableName, @@ -870,6 +881,7 @@ func (c *cc) convertInsert_stmtContext(n *parser.Insert_stmtContext) ast.Node { } insert := &ast.InsertStmt{ + WithClause: withClause, Relation: rel, Cols: c.convertColumnNames(n.AllColumn_name()), ReturningList: c.convertReturning_caluseContext(n.Returning_clause()), @@ -1020,7 +1032,29 @@ func (c *cc) convertTablesOrSubquery(n []parser.ITable_or_subqueryContext) []ast return tables } +func (c *cc) convertWithClause(w parser.IWith_clauseContext) *ast.WithClause { + var ctes ast.List + recursive := w.RECURSIVE_() != nil + for idx, cte := range w.AllCte_table_name() { + tableName := identifier(cte.Table_name().GetText()) + var cteCols ast.List + for _, col := range cte.AllColumn_name() { + cteCols.Items = append(cteCols.Items, NewIdentifier(col.GetText())) + } + ctes.Items = append(ctes.Items, &ast.CommonTableExpr{ + Ctename: &tableName, + Ctequery: c.convert(w.Select_stmt(idx)), + Location: cte.GetStart().GetStart(), + Cterecursive: recursive, + Ctecolnames: &cteCols, + }) + } + + return &ast.WithClause{Ctes: &ctes} +} + type Update_stmt interface { + With_clause() parser.IWith_clauseContext Qualified_table_name() parser.IQualified_table_nameContext GetStart() antlr.Token AllColumn_name() []parser.IColumn_nameContext @@ -1034,6 +1068,11 @@ func (c *cc) convertUpdate_stmtContext(n Update_stmt) ast.Node { return nil } + var withClause *ast.WithClause + if w := n.With_clause(); w != nil { + withClause = c.convertWithClause(w) + } + relations := &ast.List{} tableName := identifier(n.Qualified_table_name().GetText()) rel := ast.RangeVar{ @@ -1062,7 +1101,7 @@ func (c *cc) convertUpdate_stmtContext(n Update_stmt) ast.Node { TargetList: list, WhereClause: where, FromClause: &ast.List{}, - WithClause: nil, // TODO: support with clause + WithClause: withClause, } if n, ok := n.(interface { Returning_clause() parser.IReturning_clauseContext diff --git a/internal/engine/sqlite/stdlib.go b/internal/engine/sqlite/stdlib.go index 89b7af2e92..a8bf418c7f 100644 --- a/internal/engine/sqlite/stdlib.go +++ b/internal/engine/sqlite/stdlib.go @@ -980,6 +980,56 @@ func defaultSchema(name string) *catalog.Schema { }, ReturnType: &ast.TypeName{Name: "real"}, }, + { + Name: "json_each", + Args: []*catalog.Argument{ + { + Name: "json", + Type: &ast.TypeName{Name: "text"}, + }, + { + Name: "path", + Type: &ast.TypeName{Name: "text"}, + Mode: ast.FuncParamVariadic, + }, + }, + ReturnType: &ast.TypeName{ + Name: "json_tree", + }, + }, + { + Name: "json_tree", + Args: []*catalog.Argument{ + { + Name: "json", + Type: &ast.TypeName{Name: "text"}, + }, + { + Name: "path", + Type: &ast.TypeName{Name: "text"}, + Mode: ast.FuncParamVariadic, + }, + }, + ReturnType: &ast.TypeName{ + Name: "json_tree", + }, + }, + } + s.Tables = []*catalog.Table{ + { + Rel: &ast.TableName{Name: "json_tree"}, + Columns: []*catalog.Column{ + {Name: "key", Type: ast.TypeName{Name: "any"}}, + {Name: "value", Type: ast.TypeName{Name: "any"}}, + {Name: "type", Type: ast.TypeName{Name: "text"}}, + {Name: "atom", Type: ast.TypeName{Name: "any"}}, + {Name: "id", Type: ast.TypeName{Name: "integer"}}, + {Name: "parent", Type: ast.TypeName{Name: "integer"}}, + {Name: "fullkey", Type: ast.TypeName{Name: "integer"}}, + {Name: "path", Type: ast.TypeName{Name: "text"}}, + }, + Hidden: true, + }, } return s } diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index 525ffc72ef..41b839b6cf 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -517,6 +517,7 @@ type Table struct { Rel *Identifier `protobuf:"bytes,1,opt,name=rel,proto3" json:"rel,omitempty"` Columns []*Column `protobuf:"bytes,2,rep,name=columns,proto3" json:"columns,omitempty"` Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"` + Hidden bool `protobuf:"varint,4,opt,name=hidden,proto3" json:"hidden,omitempty"` } func (x *Table) Reset() { @@ -572,6 +573,13 @@ func (x *Table) GetComment() string { return "" } +func (x *Table) GetHidden() bool { + if x != nil { + return x.Hidden + } + return false +} + type Identifier struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1263,108 +1271,110 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, - 0x24, 0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x52, 0x03, 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, - 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, - 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, - 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x8e, 0x04, - 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, - 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, - 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, - 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, - 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, - 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, - 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, 0x63, - 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, - 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x65, 0x6d, 0x62, - 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, - 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, - 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, - 0x1d, 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x11, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x22, 0x94, - 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, - 0x6d, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, - 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, - 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, - 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x52, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x4b, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, - 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x22, 0x87, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, - 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, - 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, - 0x27, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, - 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x67, 0x6c, - 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x36, 0x0a, 0x10, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, - 0x69, 0x6c, 0x65, 0x73, 0x32, 0x4f, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x08, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x7c, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x73, 0x71, 0x6c, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xa2, 0x02, 0x03, - 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xca, 0x02, 0x06, 0x50, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, 0x02, 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, + 0x12, 0x24, 0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x52, 0x03, 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, + 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x69, + 0x64, 0x64, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x69, 0x64, 0x64, + 0x65, 0x6e, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x8e, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, + 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, + 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, + 0x61, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, + 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, + 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, + 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, + 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, + 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, + 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0a, 0x65, 0x6d, 0x62, + 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, + 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, + 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, + 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, + 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, + 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 0x22, 0x94, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x63, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x11, + 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x69, 0x6e, 0x73, + 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x4b, + 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0x87, 0x02, 0x0a, 0x0f, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, + 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, + 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x27, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, + 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, + 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, + 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x36, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x32, 0x4f, 0x0a, + 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x3d, 0x0a, 0x08, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x7c, + 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, + 0x64, 0x65, 0x67, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2d, 0x64, 0x65, + 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xca, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, 0x02, + 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/sql/catalog/table.go b/internal/sql/catalog/table.go index dc30acfa1e..3f2a485b5a 100644 --- a/internal/sql/catalog/table.go +++ b/internal/sql/catalog/table.go @@ -16,6 +16,7 @@ type Table struct { Rel *ast.TableName Columns []*Column Comment string + Hidden bool } func checkMissing(err error, missingOK bool) error { diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index e6faf19bad..e34bc5ea8b 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -73,6 +73,7 @@ message Table { Identifier rel = 1; repeated Column columns = 2; string comment = 3; + bool hidden = 4; } message Identifier {