MCPcopy Create free account
hub / github.com/PostHog/duckgres / hasCommandPrefix

Function hasCommandPrefix

server/conn.go:794–804  ·  view source on GitHub ↗

hasCommandPrefix checks if query starts with the given command prefix, ensuring it's followed by a word boundary (space, newline, semicolon, or end of string).

(query, prefix string)

Source from the content-addressed store, hash-verified

792 // catalog that can be referenced as ducklake.information_schema.*.
793 _, err := c.executor.ExecContext(ctx, "SELECT 1 FROM duckdb_tables() WHERE database_name = 'ducklake' LIMIT 1")
794 if err != nil {
795 c.logger().Warn("DuckLake connection unhealthy during cleanup, skipping SQL cleanup.", "error", err)
796 connHealthy = false
797 }
798 } else {
799 if err := c.executor.PingContext(ctx); err != nil {
800 c.logger().Warn("Database connection unhealthy during cleanup, skipping SQL cleanup.", "error", err)
801 connHealthy = false
802 }
803 }
804 cancel()
805
806 // If we're in a transaction, explicitly ROLLBACK before closing.
807 // This prevents DuckDB from trying to ROLLBACK internally during Close(),

Callers 1

isDuckDBUtilityCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected