mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 11:59:16 +01:00
db: fix renaming/deleting cols of DBs when there are UNIQUE(x, b, c) constraints.
Get stricter with recognizing real column defs. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
2c3d4e46fc
commit
bef2a47ab7
1 changed files with 2 additions and 1 deletions
|
@ -446,6 +446,7 @@ static bool colname_to_delete(const char **colnames,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Returns NULL if this doesn't look like a column definition */
|
||||
static const char *find_column_name(const tal_t *ctx,
|
||||
const char *sqlpart,
|
||||
size_t *after)
|
||||
|
@ -455,7 +456,7 @@ static const char *find_column_name(const tal_t *ctx,
|
|||
while (isspace(sqlpart[start]))
|
||||
start++;
|
||||
*after = strspn(sqlpart + start, "abcdefghijklmnopqrstuvwxyz_0123456789") + start;
|
||||
if (*after == start)
|
||||
if (*after == start || !cisspace(sqlpart[*after]))
|
||||
return NULL;
|
||||
return tal_strndup(ctx, sqlpart + start, *after - start);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue