mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 20:35:07 +03:00
Fix: improve SQL single-quote escaping guideline in AI prompt
The previous guideline only showed possessive examples ('Night''s watch')
but didn't emphasize contractions which commonly appear in sample content.
This led to syntax errors like "We'll" → syntax error near "ll".
Changes:
- Add **IMPORTANT** emphasis to make the rule more prominent
- Include contraction examples (We''ll, don''t, it''s)
- Add explicit reminder to check for apostrophes in sample data
https://claude.ai/code/session_01Bss7JauWALKn8gR1dLvw9P
This commit is contained in:
1 file changed
+1
-1
@@ -234,7 +234,7 @@ export const PG_BEST_PRACTICES = `
|
||||
|
||||
## SQL Style Guidelines
|
||||
- Ensure all generated SQL is valid for Postgres.
|
||||
- Always escape single quotes within strings using double apostrophes (e.g., \`'Night''s watch'\`).
|
||||
- **IMPORTANT:** Always escape single quotes within strings using double apostrophes. This includes contractions (e.g., \`'We''ll'\`, \`'don''t'\`, \`'it''s'\`) and possessives (e.g., \`'Night''s watch'\`). When generating sample data or any text content, carefully check for apostrophes and escape them.
|
||||
- Always quote identifiers (table names, column names) with double quotes when they contain uppercase letters (e.g., \`SELECT "locationType" FROM "Locations"\`), are PostgreSQL reserved words (e.g., \`"order"\`, \`"select"\`, \`"table"\`), or have special characters like dashes or spaces (e.g., \`"user-name"\`, \`"created at"\`). PostgreSQL normalizes unquoted identifiers to lowercase and reserves certain keywords.
|
||||
- Terminate each SQL statement with a semicolon (`
|
||||
;`).
|
||||
|
||||
Reference in new issue
Block a user