mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Fix \ handling
This commit is contained in:
parent
0c8ef6e5cb
commit
1b677e7e34
@ -159,14 +159,31 @@ CreateTrigger(CreateTrigStmt * stmt)
|
|||||||
|
|
||||||
foreach(le, stmt->args)
|
foreach(le, stmt->args)
|
||||||
{
|
{
|
||||||
char *ar = (char *) lfirst(le);
|
char *ar = (char *) lfirst(le);
|
||||||
|
|
||||||
len += strlen(ar) + 4;
|
len += strlen(ar) + 4;
|
||||||
|
for ( ; *ar; ar++)
|
||||||
|
{
|
||||||
|
if (*ar == '\\')
|
||||||
|
len++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
args = (char *) palloc(len + 1);
|
args = (char *) palloc(len + 1);
|
||||||
args[0] = 0;
|
args[0] = 0;
|
||||||
foreach(le, stmt->args)
|
foreach(le, stmt->args)
|
||||||
sprintf(args + strlen(args), "%s\\000", (char *) lfirst(le));
|
{
|
||||||
|
char *s = (char *) lfirst(le);
|
||||||
|
char *d = args + strlen(args);
|
||||||
|
|
||||||
|
while (*s)
|
||||||
|
{
|
||||||
|
if (*s == '\\')
|
||||||
|
*d++ = '\\';
|
||||||
|
*d++ = *s++;
|
||||||
|
}
|
||||||
|
*d = 0;
|
||||||
|
strcat(args, "\\000");
|
||||||
|
}
|
||||||
values[Anum_pg_trigger_tgnargs - 1] = Int16GetDatum(nargs);
|
values[Anum_pg_trigger_tgnargs - 1] = Int16GetDatum(nargs);
|
||||||
values[Anum_pg_trigger_tgargs - 1] = PointerGetDatum(byteain(args));
|
values[Anum_pg_trigger_tgargs - 1] = PointerGetDatum(byteain(args));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user