1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Make attalign match type alignment.

This commit is contained in:
Bruce Momjian
1998-08-26 05:22:58 +00:00
parent 651e31bb80
commit 093beb3560
10 changed files with 5411 additions and 5346 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.53 1998/08/24 19:04:04 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.54 1998/08/26 05:22:34 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -344,8 +344,8 @@ ConstructTupleDescriptor(Oid heapoid,
if (attributeList)
{
IndexKey = (IndexElem *) lfirst(attributeList);
IndexKeyType = IndexKey->typename;
attributeList = lnext(attributeList);
IndexKeyType = IndexKey->tname;
}
else
IndexKeyType = NULL;
@@ -782,7 +782,7 @@ UpdateIndexRelation(Oid indexoid,
while (attributeList != NIL)
{
IndexKey = (IndexElem *) lfirst(attributeList);
if (IndexKey->tname != NULL)
if (IndexKey->typename != NULL)
{
indexForm->indhaskeytype = 1;
break;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.22 1998/08/19 02:01:48 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.23 1998/08/26 05:22:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,7 @@
#include <catalog/index.h>
#include <catalog/pg_index.h>
#include <catalog/pg_proc.h>
#include <catalog/pg_type.h>
#include <catalog/pg_opclass.h>
#include <nodes/plannodes.h>
#include <nodes/primnodes.h>
@@ -195,9 +196,8 @@ DefineIndex(char *heapRelationName,
}
else
{
attributeNumberA =
(AttrNumber *) palloc(numberOfAttributes *
sizeof attributeNumberA[0]);
attributeNumberA = (AttrNumber *) palloc(numberOfAttributes *
sizeof attributeNumberA[0]);
classObjectId =
(Oid *) palloc(numberOfAttributes * sizeof classObjectId[0]);
@@ -464,7 +464,7 @@ FuncIndexArgs(IndexElem *funcIndex,
static void
NormIndexAttrs(List *attList, /* list of IndexElem's */
AttrNumber *attNumP,
Oid *opOidP,
Oid *classOidP,
Oid relId)
{
List *rest;
@@ -519,7 +519,22 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
elog(ERROR, "DefineIndex: %s class not found",
attribute->class);
}
*opOidP++ = tuple->t_oid;
*classOidP++ = tuple->t_oid;
/* we want the type so we can set the proper alignment, etc. */
if (attribute->typename == NULL)
{
Oid typoid = ((Form_pg_opclass) GETSTRUCT(tuple))->opcdeftype;
tuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(typoid),
0, 0, 0);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "create index: type for class '%s' undefined",
attribute->class);
/* we just set the name because that is all we need */
attribute->typename = makeNode(TypeName);
attribute->typename->name = nameout(&((TypeTupleForm) GETSTRUCT(tuple))->typname);
}
}
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.43 1998/08/04 16:43:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.44 1998/08/26 05:22:37 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -179,8 +179,8 @@ _outIndexElem(StringInfo str, IndexElem *node)
_outNode(str, node->args);
appendStringInfo(str, " :class ");
appendStringInfo(str, node->class);
appendStringInfo(str, " :tname ");
_outNode(str, node->tname);
appendStringInfo(str, " :typename ");
_outNode(str, node->typename);
}
static void

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.82 1998/08/26 04:20:27 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.83 1998/08/26 05:22:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -408,7 +408,7 @@ makeTableName(void *elem,...)
}
static char *
CreateIndexName(char *tname, char *cname, char *label, List *indices)
CreateIndexName(char *table_name, char *column_name, char *label, List *indices)
{
int pass = 0;
char *iname = NULL;
@@ -417,10 +417,10 @@ CreateIndexName(char *tname, char *cname, char *label, List *indices)
char name2[NAMEDATALEN + 1];
/* use working storage, since we might be trying several possibilities */
strcpy(name2, cname);
strcpy(name2, column_name);
while (iname == NULL)
{
iname = makeTableName(tname, name2, label, NULL);
iname = makeTableName(table_name, name2, label, NULL);
/* unable to make a name at all? then quit */
if (iname == NULL)
break;
@@ -442,7 +442,7 @@ CreateIndexName(char *tname, char *cname, char *label, List *indices)
pfree(iname);
iname = NULL;
pass++;
sprintf(name2, "%s_%d", cname, (pass + 1));
sprintf(name2, "%s_%d", column_name, (pass + 1));
}
return (iname);
@@ -700,7 +700,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
iparam->name = strcpy(palloc(strlen(column->colname) + 1), column->colname);
iparam->args = NIL;
iparam->class = NULL;
iparam->tname = NULL;
iparam->typename = NULL;
index->indexParams = lappend(index->indexParams, iparam);
if (index->idxname == NULL)

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.26 1998/08/25 21:36:53 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.27 1998/08/26 05:22:49 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -295,7 +295,7 @@ Oid param_type(int t); /* used in parse_expr.c */
NEW, NONE, NOTHING, NOTNULL, OIDS, OPERATOR, PROCEDURAL,
RECIPE, RENAME, RESET, RETURNS, ROW, RULE,
SEQUENCE, SERIAL, SETOF, SHOW, START, STATEMENT, STDIN, STDOUT, TRUSTED,
VACUUM, VERBOSE, VERSION, ENCODING
VACUUM, VERBOSE, VERSION, ENCODING, UNLISTEN
/* Keywords (obsolete; retain through next version for parser - thomas 1997-12-04) */
%token ARCHIVE
@@ -1697,7 +1697,7 @@ func_index: func_name '(' name_list ')' opt_type opt_class
$$->name = $1;
$$->args = $3;
$$->class = $6;
$$->tname = $5;
$$->typename = $5;
}
;
@@ -1707,7 +1707,7 @@ index_elem: attr_name opt_type opt_class
$$->name = $1;
$$->args = NIL;
$$->class = $3;
$$->tname = $2;
$$->typename = $2;
}
;

View File

@@ -201,34 +201,36 @@ typedef union
#define ROW 427
#define RULE 428
#define SEQUENCE 429
#define SETOF 430
#define SHOW 431
#define START 432
#define STATEMENT 433
#define STDIN 434
#define STDOUT 435
#define TRUSTED 436
#define VACUUM 437
#define VERBOSE 438
#define VERSION 439
#define ENCODING 440
#define ARCHIVE 441
#define PASSWORD 442
#define CREATEDB 443
#define NOCREATEDB 444
#define CREATEUSER 445
#define NOCREATEUSER 446
#define VALID 447
#define UNTIL 448
#define IDENT 449
#define SCONST 450
#define Op 451
#define ICONST 452
#define PARAM 453
#define FCONST 454
#define OP 455
#define UMINUS 456
#define TYPECAST 457
#define SERIAL 430
#define SETOF 431
#define SHOW 432
#define START 433
#define STATEMENT 434
#define STDIN 435
#define STDOUT 436
#define TRUSTED 437
#define VACUUM 438
#define VERBOSE 439
#define VERSION 440
#define ENCODING 441
#define UNLISTEN 442
#define ARCHIVE 443
#define PASSWORD 444
#define CREATEDB 445
#define NOCREATEDB 446
#define CREATEUSER 447
#define NOCREATEUSER 448
#define VALID 449
#define UNTIL 450
#define IDENT 451
#define SCONST 452
#define Op 453
#define ICONST 454
#define PARAM 455
#define FCONST 456
#define OP 457
#define UMINUS 458
#define TYPECAST 459
extern YYSTYPE yylval;