diff --git a/pkg/resolvespec/handler.go b/pkg/resolvespec/handler.go index 7466116..cac81df 100644 --- a/pkg/resolvespec/handler.go +++ b/pkg/resolvespec/handler.go @@ -200,7 +200,7 @@ func (h *Handler) handleRead(ctx context.Context, w common.ResponseWriter, id st if len(options.ComputedColumns) > 0 { for _, cu := range options.ComputedColumns { logger.Debug("Applying computed column: %s", cu.Name) - query = query.ColumnExpr("(?) AS "+cu.Name, cu.Expression) + query = query.ColumnExpr(fmt.Sprintf("(%s) AS %s", cu.Expression, cu.Name)) } } diff --git a/pkg/restheadspec/handler.go b/pkg/restheadspec/handler.go index 1d4dd35..770fe06 100644 --- a/pkg/restheadspec/handler.go +++ b/pkg/restheadspec/handler.go @@ -257,7 +257,7 @@ func (h *Handler) handleRead(ctx context.Context, w common.ResponseWriter, id st if len(options.ComputedQL) > 0 { for colName, colExpr := range options.ComputedQL { logger.Debug("Applying computed column: %s", colName) - query = query.ColumnExpr("(?) AS "+colName, colExpr) + query = query.ColumnExpr(fmt.Sprintf("(%s) AS %s", colExpr, colName)) for colIndex := range options.Columns { if options.Columns[colIndex] == colName { // Remove the computed column from the selected columns to avoid duplication @@ -271,7 +271,7 @@ func (h *Handler) handleRead(ctx context.Context, w common.ResponseWriter, id st if len(options.ComputedColumns) > 0 { for _, cu := range options.ComputedColumns { logger.Debug("Applying computed column: %s", cu.Name) - query = query.ColumnExpr("(?) AS "+cu.Name, cu.Expression) + query = query.ColumnExpr(fmt.Sprintf("(%s) AS %s", cu.Expression, cu.Name)) for colIndex := range options.Columns { if options.Columns[colIndex] == cu.Name { // Remove the computed column from the selected columns to avoid duplication