Skip to content

Commit 1b9a05b

Browse files
Merge pull request #2 from stackql/feature/interval-expansion-compact
interval-expansion
2 parents e5d75f0 + bfc4cfb commit 1b9a05b

File tree

3 files changed

+2876
-2810
lines changed

3 files changed

+2876
-2810
lines changed

go/vt/sqlparser/ast.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,10 @@ func (node *UnaryExpr) Format(buf *TrackedBuffer) {
18001800

18011801
// Format formats the node.
18021802
func (node *IntervalExpr) Format(buf *TrackedBuffer) {
1803-
buf.astPrintf(node, "interval %v %s", node.Expr, node.Unit)
1803+
nb := NewTrackedBuffer(nil)
1804+
nb.astPrintf(node, "%v", node.Expr)
1805+
es := strings.Trim(nb.String(), "'")
1806+
buf.astPrintf(node, "interval '%s %s'", es, node.Unit)
18041807
}
18051808

18061809
// Format formats the node.

0 commit comments

Comments
 (0)