Skip to content

Commit fcd68db

Browse files
mason-sharpclaude
andcommitted
fix: sanitize aceSchema identifier to prevent SQL breakage with non-simple names
Use pgx.Identifier.Sanitize() to quote the configurable ACE schema name in SQL templates, consistent with how all other identifiers are handled in queries.go. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fed4e9f commit fcd68db

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

db/queries/templates.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ package queries
1414
import (
1515
"text/template"
1616

17+
"github.com/jackc/pgx/v5"
1718
"github.com/pgedge/ace/pkg/config"
1819
)
1920

2021
// aceTemplateFuncs provides the {{aceSchema}} function to SQL templates.
2122
// The function is evaluated at render time (after config is loaded), not at parse time.
2223
var aceTemplateFuncs = template.FuncMap{
23-
"aceSchema": func() string { return config.Get().MTree.Schema },
24+
"aceSchema": func() string { return pgx.Identifier{config.Get().MTree.Schema}.Sanitize() },
2425
}
2526

2627
type Templates struct {

0 commit comments

Comments
 (0)