Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1b677e7

Browse files
committed
Fix \ handling
1 parent0c8ef6e commit1b677e7

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

‎src/backend/commands/trigger.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,31 @@ CreateTrigger(CreateTrigStmt * stmt)
159159

160160
foreach(le,stmt->args)
161161
{
162-
char*ar= (char*)lfirst(le);
162+
char*ar= (char*)lfirst(le);
163163

164164
len+=strlen(ar)+4;
165+
for ( ;*ar;ar++)
166+
{
167+
if (*ar=='\\')
168+
len++;
169+
}
165170
}
166171
args= (char*)palloc(len+1);
167172
args[0]=0;
168173
foreach(le,stmt->args)
169-
sprintf(args+strlen(args),"%s\\000", (char*)lfirst(le));
174+
{
175+
char*s= (char*)lfirst(le);
176+
char*d=args+strlen(args);
177+
178+
while (*s)
179+
{
180+
if (*s=='\\')
181+
*d++='\\';
182+
*d++=*s++;
183+
}
184+
*d=0;
185+
strcat(args,"\\000");
186+
}
170187
values[Anum_pg_trigger_tgnargs-1]=Int16GetDatum(nargs);
171188
values[Anum_pg_trigger_tgargs-1]=PointerGetDatum(byteain(args));
172189
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp