mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-21 03:13:05 +08:00
Repair badly broken estimation of output buffer size in lquery_out().
This commit is contained in:
parent
f758097c6d
commit
a7e383d241
@ -498,22 +498,21 @@ lquery_out(PG_FUNCTION_ARGS)
|
||||
*ptr;
|
||||
int i,
|
||||
j,
|
||||
totallen = 0;
|
||||
totallen = 1;
|
||||
lquery_level *curqlevel;
|
||||
lquery_variant *curtlevel;
|
||||
|
||||
curqlevel = LQUERY_FIRST(in);
|
||||
for (i = 0; i < in->numlevel; i++)
|
||||
{
|
||||
if (curqlevel->numvar)
|
||||
totallen = (curqlevel->numvar * 4) + 1 + curqlevel->totallen;
|
||||
else
|
||||
totallen = 2 * 11 + 4;
|
||||
totallen++;
|
||||
if (curqlevel->numvar)
|
||||
totallen += 1 + (curqlevel->numvar * 4) + curqlevel->totallen;
|
||||
else
|
||||
totallen += 2 * 11 + 4;
|
||||
curqlevel = LQL_NEXT(curqlevel);
|
||||
}
|
||||
|
||||
|
||||
ptr = buf = (char *) palloc(totallen);
|
||||
curqlevel = LQUERY_FIRST(in);
|
||||
for (i = 0; i < in->numlevel; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user