You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: preserve schema qualifiers in function/procedure bodies (#354) (#358)
Previously, schema qualifiers (e.g., public.test) were unconditionally
stripped from function/procedure bodies during normalization. This broke
functions with restrictive search_path settings (SET search_path = '',
pg_temp, etc.) where qualified references are required.
Changes:
- Move schema stripping from normalization time to comparison time
- Make stripSchemaQualifications skip dollar-quoted blocks so function
bodies applied to embedded postgres preserve their qualifiers
- Export StripSchemaPrefixFromBody for use by the diff package
- Fix dollar-quote regex to match PostgreSQL grammar (no $1$ false positives)
- Add unit tests for splitDollarQuotedSegments
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: testdata/diff/create_function/issue_354_empty_search_path/plan.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
{
10
10
"steps": [
11
11
{
12
-
"sql": "CREATE OR REPLACE FUNCTION create_hello(\n p_title text\n)\nRETURNS void\nLANGUAGE plpgsql\nVOLATILE\nSET search_path = ''\nAS $$\nBEGIN\n INSERT INTO test (title) VALUES (p_title);\nEND;\n$$;",
12
+
"sql": "CREATE OR REPLACE FUNCTION create_hello(\n p_title text\n)\nRETURNS void\nLANGUAGE plpgsql\nVOLATILE\nSET search_path = ''\nAS $$\nBEGIN\n INSERT INTO public.test (title) VALUES (p_title);\nEND;\n$$;",
0 commit comments