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

Commit617d6ea

Browse files
committed
Fix unintended assignment of sequences to the containing schema's
default tablespace --- they should always go in the database's defaulttablespace. Adjust heap_create() API so that it is passed the relkindto make this easier; should simplify any further tweaking of the samesort.
1 parenta421b4e commit617d6ea

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed

‎src/backend/bootstrap/bootparse.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.72 2004/08/29 04:12:24 momjian Exp $
12+
* $PostgreSQL: pgsql/src/backend/bootstrap/bootparse.y,v 1.73 2004/08/31 17:10:36 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -184,8 +184,8 @@ Boot_CreateStmt:
184184
PG_CATALOG_NAMESPACE,
185185
$3 ? GLOBALTABLESPACE_OID :0,
186186
tupdesc,
187+
RELKIND_RELATION,
187188
$3,
188-
true,
189189
true);
190190
elog(DEBUG4,"bootstrap relation created");
191191
}

‎src/backend/catalog/heap.c

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.275 2004/08/29 05:06:41 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.276 2004/08/31 17:10:36 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -201,12 +201,13 @@ heap_create(const char *relname,
201201
Oidrelnamespace,
202202
Oidreltablespace,
203203
TupleDesctupDesc,
204+
charrelkind,
204205
boolshared_relation,
205-
boolcreate_storage,
206206
boolallow_system_table_mods)
207207
{
208208
Oidrelid;
209209
boolnailme= false;
210+
boolcreate_storage;
210211
Relationrel;
211212

212213
/*
@@ -263,6 +264,34 @@ heap_create(const char *relname,
263264
else
264265
relid=newoid();
265266

267+
/*
268+
* Decide if we need storage or not, and handle a couple other
269+
* special cases for particular relkinds.
270+
*/
271+
switch (relkind)
272+
{
273+
caseRELKIND_VIEW:
274+
caseRELKIND_COMPOSITE_TYPE:
275+
create_storage= false;
276+
/*
277+
* Force reltablespace to zero if the relation has no physical
278+
* storage. This is mainly just for cleanliness' sake.
279+
*/
280+
reltablespace=InvalidOid;
281+
break;
282+
caseRELKIND_SEQUENCE:
283+
create_storage= true;
284+
/*
285+
* Force reltablespace to zero for sequences, since we don't
286+
* support moving them around into different tablespaces.
287+
*/
288+
reltablespace=InvalidOid;
289+
break;
290+
default:
291+
create_storage= true;
292+
break;
293+
}
294+
266295
/*
267296
* Never allow a pg_class entry to explicitly specify the database's
268297
* default tablespace in reltablespace; force it to zero instead. This
@@ -275,13 +304,6 @@ heap_create(const char *relname,
275304
if (reltablespace==MyDatabaseTableSpace)
276305
reltablespace=InvalidOid;
277306

278-
/*
279-
* Also, force reltablespace to zero if the relation has no physical
280-
* storage. This is mainly just for cleanliness' sake.
281-
*/
282-
if (!create_storage)
283-
reltablespace=InvalidOid;
284-
285307
/*
286308
* build the relcache entry.
287309
*/
@@ -728,16 +750,13 @@ heap_create_with_catalog(const char *relname,
728750
* Create the relcache entry (mostly dummy at this point) and the
729751
* physical disk file.(If we fail further down, it's the smgr's
730752
* responsibility to remove the disk file again.)
731-
*
732-
* NB: create a physical file only if it's not a view or type relation.
733753
*/
734754
new_rel_desc=heap_create(relname,
735755
relnamespace,
736756
reltablespace,
737757
tupdesc,
758+
relkind,
738759
shared_relation,
739-
(relkind!=RELKIND_VIEW&&
740-
relkind!=RELKIND_COMPOSITE_TYPE),
741760
allow_system_table_mods);
742761

743762
/* Fetch the relation OID assigned by heap_create */

‎src/backend/catalog/index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.238 2004/08/29 05:06:41 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.239 2004/08/31 17:10:36 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -543,8 +543,8 @@ index_create(Oid heapRelationId,
543543
namespaceId,
544544
tableSpaceId,
545545
indexTupDesc,
546+
RELKIND_INDEX,
546547
shared_relation,
547-
true,
548548
allow_system_table_mods);
549549

550550
/* Fetch the relation OID assigned by heap_create */

‎src/include/catalog/heap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/catalog/heap.h,v 1.70 2004/08/29 04:13:04 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/catalog/heap.h,v 1.71 2004/08/31 17:10:36 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -39,8 +39,8 @@ extern Relation heap_create(const char *relname,
3939
Oidrelnamespace,
4040
Oidreltablespace,
4141
TupleDesctupDesc,
42+
charrelkind,
4243
boolshared_relation,
43-
boolcreate_storage,
4444
boolallow_system_table_mods);
4545

4646
externOidheap_create_with_catalog(constchar*relname,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp