diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y index 1ec0e5c8a9..c2d478e632 100644 --- a/src/backend/bootstrap/bootparse.y +++ b/src/backend/bootstrap/bootparse.y @@ -115,6 +115,10 @@ static int num_columns_read = 0; %type optbootstrap optsharedrelation optwithoutoids boot_column_nullness %type oidspec optoideq optrowtypeoid +/* + * These tokens are also listed in genbki.pl. If making changes here, + * be certain to update the list there. + */ %token ID %token OPEN XCLOSE XCREATE INSERT_TUPLE %token XDECLARE INDEX ON USING XBUILD INDICES UNIQUE XTOAST diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index fb61db0a05..299ba27682 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -737,10 +737,19 @@ sub print_bki_insert $bki_value =~ s/"/\\042/g; # Quote value if needed. We need not quote values that satisfy - # the "id" pattern in bootscanner.l, currently "[-A-Za-z0-9_]+". + # the "id" pattern in bootscanner.l, currently "[-A-Za-z0-9_]+", + # unless they are a keyword token that would confuse the scanner. $bki_value = sprintf(qq'"%s"', $bki_value) if length($bki_value) == 0 - or $bki_value =~ /[^-A-Za-z0-9_]/; + or $bki_value =~ /[^-A-Za-z0-9_]/ + # List of tokens from bootparse.y. Keep these two files consistent. + or $bki_value =~ / + \b(?: + ID|OPEN|CLOSE|CREATE|INSERT_TUPLE|DECLARE|INDEX|ON| + USING|BUILD|INDICES|UNIQUE|TOAST|COMMA|EQUALS|LPAREN| + RPAREN|OBJ_ID|BOOTSTRAP|SHARED_RELATION|WITHOUT_OIDS| + ROWTYPE_OID|NULLVAL|FORCE|NOT|NULL + )\b/ix; push @bki_values, $bki_value; }