diff options
Diffstat (limited to 'src/backend/parser')
-rw-r--r-- | src/backend/parser/gram.y | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 0efe1705e24..363c603848d 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -1450,10 +1450,7 @@ set_rest_more: /* Generic SET syntaxes: */ var_name: ColId { $$ = $1; } | var_name '.' ColId - { - $$ = palloc(strlen($1) + strlen($3) + 2); - sprintf($$, "%s.%s", $1, $3); - } + { $$ = psprintf("%s.%s", $1, $3); } ; var_list: var_value { $$ = list_make1($1); } @@ -10327,15 +10324,7 @@ ConstCharacter: CharacterWithLength CharacterWithLength: character '(' Iconst ')' opt_charset { if (($5 != NULL) && (strcmp($5, "sql_text") != 0)) - { - char *type; - - type = palloc(strlen($1) + 1 + strlen($5) + 1); - strcpy(type, $1); - strcat(type, "_"); - strcat(type, $5); - $1 = type; - } + $1 = psprintf("%s_%s", $1, $5); $$ = SystemTypeName($1); $$->typmods = list_make1(makeIntConst($3, @3)); @@ -10346,15 +10335,7 @@ CharacterWithLength: character '(' Iconst ')' opt_charset CharacterWithoutLength: character opt_charset { if (($2 != NULL) && (strcmp($2, "sql_text") != 0)) - { - char *type; - - type = palloc(strlen($1) + 1 + strlen($2) + 1); - strcpy(type, $1); - strcat(type, "_"); - strcat(type, $2); - $1 = type; - } + $1 = psprintf("%s_%s", $1, $2); $$ = SystemTypeName($1); @@ -13339,13 +13320,7 @@ doNegateFloat(Value *v) if (*oldval == '-') v->val.str = oldval+1; /* just strip the '-' */ else - { - char *newval = (char *) palloc(strlen(oldval) + 2); - - *newval = '-'; - strcpy(newval+1, oldval); - v->val.str = newval; - } + v->val.str = psprintf("-%s", oldval); } static Node * |