Escape Identifier when building up SQL dynamically

Signed-off-by: Feike Steenbergen <feike@timescale.com>
This commit is contained in:
Feike Steenbergen 2022-06-02 08:37:49 +02:00
parent 1b492a6c59
commit 1e9b19da84
No known key found for this signature in database
GPG Key ID: BE67E84EF3533CA4

View File

@ -43,9 +43,7 @@ func queryNamespaceMapping(server *Server, namespace string, mapping MetricMapNa
var err error var err error
if !found { if !found {
// I've no idea how to avoid this properly at the moment, but this is rows, err = server.db.Query(fmt.Sprintf("SELECT * FROM %s;", pq.QuoteIdentifier(namespace))) // nolint: gas
// an admin tool so you're not injecting SQL right?
rows, err = server.db.Query(fmt.Sprintf("SELECT * FROM %s;", namespace)) // nolint: gas
} else { } else {
rows, err = server.db.Query(query) rows, err = server.db.Query(query)
} }