1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-24 00:23:06 +03:00

Simplify the bootstrap (BKI) code by getting rid of a useless table of all

the strings seen during the bootstrap run.  There might have been some
actual point to doing that, many years ago, but as far as I can see the only
value now is to conserve a bit of memory.  Even if we cared about wasting
a megabyte or so during the initdb run, it'd be far more effective to
arrange to release memory at the end of each BKI command, instead of
intentionally hanging onto strings that might never be used again.
Not maintaining the table probably makes it faster too; but the main point
of this patch is to get rid of a couple hundred lines of unnecessary and
rather crufty code.
This commit is contained in:
Tom Lane
2009-09-27 01:32:11 +00:00
parent 23cf415a65
commit 12d8fae4cd
4 changed files with 66 additions and 255 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.49 2009/09/26 22:42:01 tgl Exp $
* $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.50 2009/09/27 01:32:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -104,21 +104,16 @@ insert { return(INSERT_TUPLE); }
"toast" { return(XTOAST); }
{arrayid} {
yylval.ival = EnterString(MapArrayTypeName((char*)yytext));
yylval.str = pstrdup(MapArrayTypeName(yytext));
return(ID);
}
{id} {
char *newid = scanstr((char*)yytext);
yylval.ival = EnterString(newid);
pfree(newid);
yylval.str = scanstr(yytext);
return(ID);
}
{sid} {
char *newid;
yytext[strlen(yytext)-1] = '\0'; /* strip off quotes */
newid = scanstr((char*)yytext+1);
yylval.ival = EnterString(newid);
pfree(newid);
yylval.str = scanstr(yytext+1);
yytext[strlen(yytext)] = '"'; /* restore quotes */
return(ID);
}
@@ -126,7 +121,7 @@ insert { return(INSERT_TUPLE); }
(-)?{D}+"."{D}*({Exp})? |
(-)?{D}*"."{D}+({Exp})? |
(-)?{D}+{Exp} {
yylval.ival = EnterString((char*)yytext);
yylval.str = pstrdup(yytext);
return(CONST_P);
}