Skip to content

Quote SQL table identifiers to support special characters in event names#10

Open
joelhelbling wants to merge 1 commit into
nafey:masterfrom
joelhelbling:fix-sql-identifier-quoting
Open

Quote SQL table identifiers to support special characters in event names#10
joelhelbling wants to merge 1 commit into
nafey:masterfrom
joelhelbling:fix-sql-identifier-quoting

Conversation

@joelhelbling

Copy link
Copy Markdown
Contributor

Summary

  • Wraps all dynamic table names in double quotes to treat them as SQL identifiers
  • Fixes panic when event names contain hyphens (e.g., pageview_docs_getting-started)
  • The hyphen was being interpreted as a subtraction operator, causing syntax errors

Problem

Event names containing special characters like - caused the server to panic:

panic: near "-": syntax error

This occurred in DeleteEvents() and would affect any SQL query using dynamic table names.

Test plan

  • Submit an event with a hyphen in the name (e.g., curl -X POST http://localhost:3333/api/event/ -d '{"event": "test-event"}')
  • Verify server doesn't panic during the cleanup goroutine
  • Verify stats can be retrieved for events with special characters

🤖 Generated with Claude Code

Event names containing hyphens (e.g., "pageview_docs_getting-started") caused
SQL syntax errors because the hyphen was interpreted as subtraction. This wraps
all dynamic table names in double quotes to treat them as identifiers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant