Skip to content

Commit a040281

Browse files
committed
Move fixes for >8 indexed fields.
1 parent b99f300 commit a040281

File tree

5 files changed

+268
-268
lines changed

5 files changed

+268
-268
lines changed

src/backend/parser/analyze.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: analyze.c,v 1.127 2000/01/06 20:46:49 wieck Exp $
8+
* $Id: analyze.c,v 1.128 2000/01/10 05:20:21 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -674,7 +674,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
674674

675675
fkconstraint = (FkConstraint *)constraint;
676676
fkconstraint->fk_attrs = lappend(NIL, id);
677-
677+
678678
fkconstraints = lappend(fkconstraints, constraint);
679679
continue;
680680
}
@@ -960,7 +960,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
960960
*/
961961
if (fkconstraint->fk_attrs != NIL && fkconstraint->pk_attrs == NIL)
962962
transformFkeyGetPrimaryKey(fkconstraint);
963-
963+
964964
/*
965965
* Build a CREATE CONSTRAINT TRIGGER statement for the CHECK
966966
* action.
@@ -1016,7 +1016,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
10161016
extras_after = lappend(extras_after, (Node *)fk_trigger);
10171017

10181018
/*
1019-
* Build a CREATE CONSTRAINT TRIGGER statement for the
1019+
* Build a CREATE CONSTRAINT TRIGGER statement for the
10201020
* ON DELETE action fired on the PK table !!!
10211021
*
10221022
*/
@@ -1084,7 +1084,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
10841084
extras_after = lappend(extras_after, (Node *)fk_trigger);
10851085

10861086
/*
1087-
* Build a CREATE CONSTRAINT TRIGGER statement for the
1087+
* Build a CREATE CONSTRAINT TRIGGER statement for the
10881088
* ON UPDATE action fired on the PK table !!!
10891089
*
10901090
*/
@@ -1679,7 +1679,7 @@ transformFkeyGetPrimaryKey(FkConstraint *fkconstraint)
16791679
* using the attribute names of the PK relation descriptor
16801680
* ----------
16811681
*/
1682-
for (i = 0; i < 8 && indexStruct->indkey[i] != 0; i++)
1682+
for (i = 0; i < INDEX_MAX_KEYS && indexStruct->indkey[i] != 0; i++)
16831683
{
16841684
pkattno = indexStruct->indkey[i];
16851685
pkattr = (Ident *)makeNode(Ident);

src/backend/utils/adt/int.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.27 1999/07/17 20:17:56 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.28 2000/01/10 05:20:23 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -76,29 +76,26 @@ int2out(int16 sh)
7676
* Fills any nonexistent digits with NULLs.
7777
*/
7878
int16 *
79-
int28in(char *shs)
79+
int28in(char *intString)
8080
{
8181
int16 *result;
82-
int nums;
82+
int slot;
8383

84-
if (shs == NULL)
84+
if (intString == NULL)
8585
return NULL;
8686

87-
result = (int16 *) palloc(sizeof(int16[8]));
88-
if ((nums = sscanf(shs, "%hd%hd%hd%hd%hd%hd%hd%hd",
89-
&result[0],
90-
&result[1],
91-
&result[2],
92-
&result[3],
93-
&result[4],
94-
&result[5],
95-
&result[6],
96-
&result[7])) != 8)
87+
result = (int16 *) palloc(sizeof(int16[INDEX_MAX_KEYS]));
88+
89+
for (slot=0; *intString && slot < INDEX_MAX_KEYS; slot++)
9790
{
98-
do
99-
result[nums++] = 0;
100-
while (nums < 8);
91+
if (sscanf(intString, "%hd", &result[slot]) != 1)
92+
break;
93+
while (*intString && *intString != ' ')
94+
intString++;
10195
}
96+
while (slot < INDEX_MAX_KEYS)
97+
result[slot++] = 0;
98+
10299
return result;
103100
}
104101

@@ -120,10 +117,10 @@ int28out(int16 *shs)
120117
result[1] = '\0';
121118
return result;
122119
}
123-
rp = result = (char *) palloc(8 * 7); /* assumes sign, 5 digits,
124-
* ' ' */
120+
rp = result = (char *) palloc(INDEX_MAX_KEYS * 7);
121+
/* assumes sign, 5 digits, ' ' */
125122
sp = shs;
126-
for (num = 8; num != 0; num--)
123+
for (num = INDEX_MAX_KEYS; num != 0; num--)
127124
{
128125
itoa(*sp++, rp);
129126
while (*++rp != '\0')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy