Fix a bug that pg_reorg cannot parse index definitions with reserved named columns,
i.e, it failed to parse quoted column names. (bug #1010828)
This commit is contained in:
26
lib/reorg.c
26
lib/reorg.c
@ -360,7 +360,6 @@ skip_until(Oid index, char *sql, char end)
|
||||
char instr = 0;
|
||||
int nopen = 0;
|
||||
|
||||
sql++;
|
||||
for (; *sql && (nopen > 0 || instr != 0 || *sql != end); sql++)
|
||||
{
|
||||
if (instr)
|
||||
@ -491,29 +490,8 @@ reorg_get_index_keys(PG_FUNCTION_ARGS)
|
||||
while (isspace((unsigned char) *token))
|
||||
token++;
|
||||
next = skip_until(index, next, ',');
|
||||
|
||||
opcname = token + strlen(token);
|
||||
if (opcname[-1] == '"')
|
||||
{
|
||||
opcname--;
|
||||
for (;;)
|
||||
{
|
||||
char *beg = strrchr(opcname, '"');
|
||||
if (beg == NULL)
|
||||
parse_error(index);
|
||||
else if (beg[-1] != '"')
|
||||
break;
|
||||
else /* escaped quote ("") */
|
||||
opcname = beg - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (opcname > token && IsToken(opcname[-1]))
|
||||
opcname--;
|
||||
}
|
||||
|
||||
if (opcname > token && *opcname)
|
||||
opcname = skip_until(index, token, ' ');
|
||||
if (opcname)
|
||||
{
|
||||
/* lookup default operator name from operator class */
|
||||
|
||||
|
Reference in New Issue
Block a user