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

Commit0352e3a

Browse files
committed
Un-break table creation.
1 parenta3519a2 commit0352e3a

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

‎src/backend/catalog/heap.c

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.202 2002/05/2207:46:58 inoue Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.203 2002/05/2215:35:43 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -353,7 +353,7 @@ heap_storage_create(Relation rel)
353353
* --------------------------------
354354
*/
355355
staticvoid
356-
CheckAttributeNames(TupleDesctupdesc,boolrelhasoids,intrelkind)
356+
CheckAttributeNames(TupleDesctupdesc,boolrelhasoids,charrelkind)
357357
{
358358
inti;
359359
intj;
@@ -362,21 +362,30 @@ CheckAttributeNames(TupleDesc tupdesc, bool relhasoids, int relkind)
362362
/*
363363
* first check for collision with system attribute names
364364
*
365-
* also, warn user if attribute to be created has an unknown typid
366-
* (usually as a result of a 'retrieve into' - jolly
365+
* Skip this for a view, since it doesn't have system attributes.
367366
*/
368367
if (relkind!=RELKIND_VIEW)
368+
{
369369
for (i=0;i<natts;i++)
370370
{
371371
if (SystemAttributeByName(NameStr(tupdesc->attrs[i]->attname),
372-
relhasoids)!=NULL)
372+
relhasoids)!=NULL)
373373
elog(ERROR,"name of column \"%s\" conflicts with an existing system column",
374-
NameStr(tupdesc->attrs[i]->attname));
375-
if (tupdesc->attrs[i]->atttypid==UNKNOWNOID)
376-
elog(WARNING,"Attribute '%s' has an unknown type"
374+
NameStr(tupdesc->attrs[i]->attname));
375+
}
376+
}
377+
378+
/*
379+
* also, warn user if attribute to be created has an unknown typid
380+
* (usually as a result of a 'retrieve into' - jolly
381+
*/
382+
for (i=0;i<natts;i++)
383+
{
384+
if (tupdesc->attrs[i]->atttypid==UNKNOWNOID)
385+
elog(WARNING,"Attribute '%s' has an unknown type"
377386
"\n\tProceeding with relation creation anyway",
378387
NameStr(tupdesc->attrs[i]->attname));
379-
}
388+
}
380389

381390
/*
382391
* next check for repeated attribute names
@@ -404,7 +413,7 @@ static void
404413
AddNewAttributeTuples(Oidnew_rel_oid,
405414
TupleDesctupdesc,
406415
boolrelhasoids,
407-
intrelkind)
416+
charrelkind)
408417
{
409418
Form_pg_attribute*dpp;
410419
inti;
@@ -454,17 +463,18 @@ AddNewAttributeTuples(Oid new_rel_oid,
454463
/*
455464
* next we add the system attributes. Skip OID if rel has no OIDs.
456465
*/
457-
dpp=SysAtt;
458466
if (relkind!=RELKIND_VIEW)
467+
{
468+
dpp=SysAtt;
459469
for (i=0;i<-1-FirstLowInvalidHeapAttributeNumber;i++)
460470
{
461471
if (relhasoids|| (*dpp)->attnum!=ObjectIdAttributeNumber)
462472
{
463473
Form_pg_attributeattStruct;
464474

465475
tup=heap_addheader(Natts_pg_attribute,
466-
ATTRIBUTE_TUPLE_SIZE,
467-
(void*)*dpp);
476+
ATTRIBUTE_TUPLE_SIZE,
477+
(void*)*dpp);
468478

469479
/* Fill in the correct relation OID in the copied tuple */
470480
attStruct= (Form_pg_attribute)GETSTRUCT(tup);
@@ -484,7 +494,9 @@ AddNewAttributeTuples(Oid new_rel_oid,
484494

485495
heap_freetuple(tup);
486496
}
497+
dpp++;
487498
}
499+
}
488500

489501
/*
490502
* close pg_attribute indices
@@ -719,7 +731,8 @@ heap_create_with_catalog(const char *relname,
719731
* now add tuples to pg_attribute for the attributes in our new
720732
* relation.
721733
*/
722-
AddNewAttributeTuples(new_rel_oid,new_rel_desc->rd_att,relhasoids,relkind);
734+
AddNewAttributeTuples(new_rel_oid,new_rel_desc->rd_att,
735+
relhasoids,relkind);
723736

724737
/*
725738
* store constraints and defaults passed in the tupdesc, if any.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp