diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/parser/analyze.c | 12 | ||||
-rw-r--r-- | src/backend/utils/adt/int.c | 37 |
2 files changed, 23 insertions, 26 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index afcbcce3ed9..2ac263fb267 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -5,7 +5,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: analyze.c,v 1.127 2000/01/06 20:46:49 wieck Exp $ + * $Id: analyze.c,v 1.128 2000/01/10 05:20:21 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -674,7 +674,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt) fkconstraint = (FkConstraint *)constraint; fkconstraint->fk_attrs = lappend(NIL, id); - + fkconstraints = lappend(fkconstraints, constraint); continue; } @@ -960,7 +960,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt) */ if (fkconstraint->fk_attrs != NIL && fkconstraint->pk_attrs == NIL) transformFkeyGetPrimaryKey(fkconstraint); - + /* * Build a CREATE CONSTRAINT TRIGGER statement for the CHECK * action. @@ -1016,7 +1016,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt) extras_after = lappend(extras_after, (Node *)fk_trigger); /* - * Build a CREATE CONSTRAINT TRIGGER statement for the + * Build a CREATE CONSTRAINT TRIGGER statement for the * ON DELETE action fired on the PK table !!! * */ @@ -1084,7 +1084,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt) extras_after = lappend(extras_after, (Node *)fk_trigger); /* - * Build a CREATE CONSTRAINT TRIGGER statement for the + * Build a CREATE CONSTRAINT TRIGGER statement for the * ON UPDATE action fired on the PK table !!! * */ @@ -1679,7 +1679,7 @@ transformFkeyGetPrimaryKey(FkConstraint *fkconstraint) * using the attribute names of the PK relation descriptor * ---------- */ - for (i = 0; i < 8 && indexStruct->indkey[i] != 0; i++) + for (i = 0; i < INDEX_MAX_KEYS && indexStruct->indkey[i] != 0; i++) { pkattno = indexStruct->indkey[i]; pkattr = (Ident *)makeNode(Ident); diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c index 3d37054d7cc..041ac3d2ec8 100644 --- a/src/backend/utils/adt/int.c +++ b/src/backend/utils/adt/int.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.27 1999/07/17 20:17:56 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.28 2000/01/10 05:20:23 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -76,29 +76,26 @@ int2out(int16 sh) * Fills any nonexistent digits with NULLs. */ int16 * -int28in(char *shs) +int28in(char *intString) { int16 *result; - int nums; + int slot; - if (shs == NULL) + if (intString == NULL) return NULL; - result = (int16 *) palloc(sizeof(int16[8])); - if ((nums = sscanf(shs, "%hd%hd%hd%hd%hd%hd%hd%hd", - &result[0], - &result[1], - &result[2], - &result[3], - &result[4], - &result[5], - &result[6], - &result[7])) != 8) + result = (int16 *) palloc(sizeof(int16[INDEX_MAX_KEYS])); + + for (slot=0; *intString && slot < INDEX_MAX_KEYS; slot++) { - do - result[nums++] = 0; - while (nums < 8); + if (sscanf(intString, "%hd", &result[slot]) != 1) + break; + while (*intString && *intString != ' ') + intString++; } + while (slot < INDEX_MAX_KEYS) + result[slot++] = 0; + return result; } @@ -120,10 +117,10 @@ int28out(int16 *shs) result[1] = '\0'; return result; } - rp = result = (char *) palloc(8 * 7); /* assumes sign, 5 digits, - * ' ' */ + rp = result = (char *) palloc(INDEX_MAX_KEYS * 7); + /* assumes sign, 5 digits, ' ' */ sp = shs; - for (num = 8; num != 0; num--) + for (num = INDEX_MAX_KEYS; num != 0; num--) { itoa(*sp++, rp); while (*++rp != '\0') |