Skip to content

Commit 12ffdbb

Browse files
committed
fix
1 parent 13fc9f3 commit 12ffdbb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/cmd/plugin_engine.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/sqlc-dev/sqlc/internal/config"
1818
"github.com/sqlc-dev/sqlc/internal/metadata"
1919
"github.com/sqlc-dev/sqlc/internal/multierr"
20+
"github.com/sqlc-dev/sqlc/internal/sql/ast"
2021
"github.com/sqlc-dev/sqlc/internal/sql/catalog"
2122
"github.com/sqlc-dev/sqlc/internal/sql/sqlpath"
2223
"google.golang.org/protobuf/proto"
@@ -242,6 +243,7 @@ func statementToCompilerQuery(st *pb.Statement, filename string) *compiler.Query
242243
var params []compiler.Parameter
243244
for _, p := range st.GetParameters() {
244245
col := &compiler.Column{
246+
Name: p.GetName(),
245247
DataType: p.GetDataType(),
246248
NotNull: !p.GetNullable(),
247249
IsArray: p.GetIsArray(),
@@ -255,13 +257,17 @@ func statementToCompilerQuery(st *pb.Statement, filename string) *compiler.Query
255257
}
256258
var columns []*compiler.Column
257259
for _, c := range st.GetColumns() {
258-
columns = append(columns, &compiler.Column{
260+
col := &compiler.Column{
259261
Name: c.GetName(),
260262
DataType: c.GetDataType(),
261263
NotNull: !c.GetNullable(),
262264
IsArray: c.GetIsArray(),
263265
ArrayDims: int(c.GetArrayDims()),
264-
})
266+
}
267+
if tn := c.GetTableName(); tn != "" {
268+
col.Table = &ast.TableName{Name: tn}
269+
}
270+
columns = append(columns, col)
265271
}
266272
return &compiler.Query{
267273
SQL: sqlTrimmed,

0 commit comments

Comments
 (0)