Skip to content

Log invalid use of _cf_ table prefix#6448

Open
maxmcd wants to merge 1 commit intomainfrom
mmcdonnell/cf-table-prefix-logs
Open

Log invalid use of _cf_ table prefix#6448
maxmcd wants to merge 1 commit intomainfrom
mmcdonnell/cf-table-prefix-logs

Conversation

@maxmcd
Copy link
Copy Markdown
Contributor

@maxmcd maxmcd commented Mar 27, 2026

Add warning logs to detect SQL identifiers using mixed-case cf prefix variants (e.g. CF, Cf) and FTS5 virtual tables using any-case cf prefix.

@maxmcd maxmcd requested review from a team as code owners March 27, 2026 21:48
Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm Bonk, and I've done a quick review of your PR.

This PR adds warning logs to detect mixed-case _cf_ prefix usage in SQL identifiers and FTS5 virtual tables.

Issues

  1. [High] <strings.h> included unconditionally — breaks Windows/MSVC build.
    strncasecmp is a POSIX function declared in <strings.h>, which doesn't exist on MSVC. Other files in the codebase handle this: form-data.c++ guards the include with #if !_MSC_VER, and sqlite.c++ uses #define strncasecmp _strnicmp. The new code in sql.c++ does neither.

  2. [Low] Log messages don't include the offending identifier.
    Since LOG_WARNING_PERIODICALLY is rate-limited to once per hour per call site, including the actual name would be much more useful for debugging when these fire in production. Both call sites have the name readily available.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 27, 2026

Review posted successfully on PR #6448. Here's a summary of the findings:

  1. [High] <strings.h> portability issue — The POSIX header is included unconditionally in sql.c++, which will break Windows/MSVC builds. Suggested a platform-guarded fix matching the pattern used in sqlite.c++.

  2. [Low] Log messages missing identifier names — Both LOG_WARNING_PERIODICALLY call sites omit the offending SQL identifier/table name. Since these are rate-limited to once per hour, including the name would significantly help debugging.

All three issues have concrete suggestion comments on the PR.

github run

@maxmcd maxmcd force-pushed the mmcdonnell/cf-table-prefix-logs branch from b3f85bb to 5fb5497 Compare March 28, 2026 21:19
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