Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit093beb3

Browse files
committed
Make attalign match type alignment.
1 parent651e31b commit093beb3

File tree

10 files changed

+5063
-4998
lines changed

10 files changed

+5063
-4998
lines changed

‎src/backend/catalog/index.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.53 1998/08/24 19:04:04 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.54 1998/08/26 05:22:34 momjian Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -344,8 +344,8 @@ ConstructTupleDescriptor(Oid heapoid,
344344
if (attributeList)
345345
{
346346
IndexKey= (IndexElem*)lfirst(attributeList);
347+
IndexKeyType=IndexKey->typename;
347348
attributeList=lnext(attributeList);
348-
IndexKeyType=IndexKey->tname;
349349
}
350350
else
351351
IndexKeyType=NULL;
@@ -782,7 +782,7 @@ UpdateIndexRelation(Oid indexoid,
782782
while (attributeList!=NIL)
783783
{
784784
IndexKey= (IndexElem*)lfirst(attributeList);
785-
if (IndexKey->tname!=NULL)
785+
if (IndexKey->typename!=NULL)
786786
{
787787
indexForm->indhaskeytype=1;
788788
break;

‎src/backend/commands/defind.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.22 1998/08/19 02:01:48 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.23 1998/08/26 05:22:36 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -23,6 +23,7 @@
2323
#include<catalog/index.h>
2424
#include<catalog/pg_index.h>
2525
#include<catalog/pg_proc.h>
26+
#include<catalog/pg_type.h>
2627
#include<catalog/pg_opclass.h>
2728
#include<nodes/plannodes.h>
2829
#include<nodes/primnodes.h>
@@ -195,9 +196,8 @@ DefineIndex(char *heapRelationName,
195196
}
196197
else
197198
{
198-
attributeNumberA=
199-
(AttrNumber*)palloc(numberOfAttributes*
200-
sizeofattributeNumberA[0]);
199+
attributeNumberA= (AttrNumber*)palloc(numberOfAttributes*
200+
sizeofattributeNumberA[0]);
201201

202202
classObjectId=
203203
(Oid*)palloc(numberOfAttributes*sizeofclassObjectId[0]);
@@ -464,7 +464,7 @@ FuncIndexArgs(IndexElem *funcIndex,
464464
staticvoid
465465
NormIndexAttrs(List*attList,/* list of IndexElem's */
466466
AttrNumber*attNumP,
467-
Oid*opOidP,
467+
Oid*classOidP,
468468
OidrelId)
469469
{
470470
List*rest;
@@ -519,7 +519,22 @@ NormIndexAttrs(List *attList,/* list of IndexElem's */
519519
elog(ERROR,"DefineIndex: %s class not found",
520520
attribute->class);
521521
}
522-
*opOidP++=tuple->t_oid;
522+
*classOidP++=tuple->t_oid;
523+
/* we want the type so we can set the proper alignment, etc. */
524+
if (attribute->typename==NULL)
525+
{
526+
Oidtypoid= ((Form_pg_opclass)GETSTRUCT(tuple))->opcdeftype;
527+
528+
tuple=SearchSysCacheTuple(TYPOID,
529+
ObjectIdGetDatum(typoid),
530+
0,0,0);
531+
if (!HeapTupleIsValid(tuple))
532+
elog(ERROR,"create index: type for class '%s' undefined",
533+
attribute->class);
534+
/* we just set the name because that is all we need */
535+
attribute->typename=makeNode(TypeName);
536+
attribute->typename->name=nameout(&((TypeTupleForm)GETSTRUCT(tuple))->typname);
537+
}
523538
}
524539
}
525540

‎src/backend/nodes/outfuncs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.43 1998/08/04 16:43:59 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.44 1998/08/26 05:22:37 momjian Exp $
1111
*
1212
* NOTES
1313
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -179,8 +179,8 @@ _outIndexElem(StringInfo str, IndexElem *node)
179179
_outNode(str,node->args);
180180
appendStringInfo(str," :class ");
181181
appendStringInfo(str,node->class);
182-
appendStringInfo(str," :tname ");
183-
_outNode(str,node->tname);
182+
appendStringInfo(str," :typename ");
183+
_outNode(str,node->typename);
184184
}
185185

186186
staticvoid

‎src/backend/parser/analyze.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.82 1998/08/2604:20:27 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.83 1998/08/2605:22:40 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -408,7 +408,7 @@ makeTableName(void *elem,...)
408408
}
409409

410410
staticchar*
411-
CreateIndexName(char*tname,char*cname,char*label,List*indices)
411+
CreateIndexName(char*table_name,char*column_name,char*label,List*indices)
412412
{
413413
intpass=0;
414414
char*iname=NULL;
@@ -417,10 +417,10 @@ CreateIndexName(char *tname, char *cname, char *label, List *indices)
417417
charname2[NAMEDATALEN+1];
418418

419419
/* use working storage, since we might be trying several possibilities */
420-
strcpy(name2,cname);
420+
strcpy(name2,column_name);
421421
while (iname==NULL)
422422
{
423-
iname=makeTableName(tname,name2,label,NULL);
423+
iname=makeTableName(table_name,name2,label,NULL);
424424
/* unable to make a name at all? then quit */
425425
if (iname==NULL)
426426
break;
@@ -442,7 +442,7 @@ CreateIndexName(char *tname, char *cname, char *label, List *indices)
442442
pfree(iname);
443443
iname=NULL;
444444
pass++;
445-
sprintf(name2,"%s_%d",cname, (pass+1));
445+
sprintf(name2,"%s_%d",column_name, (pass+1));
446446
}
447447

448448
return (iname);
@@ -700,7 +700,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
700700
iparam->name=strcpy(palloc(strlen(column->colname)+1),column->colname);
701701
iparam->args=NIL;
702702
iparam->class=NULL;
703-
iparam->tname=NULL;
703+
iparam->typename=NULL;
704704
index->indexParams=lappend(index->indexParams,iparam);
705705

706706
if (index->idxname==NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp