|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.280 2009/02/11 21:11:16 tgl Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.281 2009/03/31 22:12:47 tgl Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -1056,7 +1056,7 @@ truncate_check_rel(Relation rel) |
1056 | 1056 | * Don't allow truncate on temp tables of other backends ... their local |
1057 | 1057 | * buffer manager is not going to cope. |
1058 | 1058 | */ |
1059 | | -if (isOtherTempNamespace(RelationGetNamespace(rel))) |
| 1059 | +if (RELATION_IS_OTHER_TEMP(rel)) |
1060 | 1060 | ereport(ERROR, |
1061 | 1061 | (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
1062 | 1062 | errmsg("cannot truncate temporary tables of other sessions"))); |
@@ -1203,7 +1203,7 @@ MergeAttributes(List *schema, List *supers, bool istemp, |
1203 | 1203 | errmsg("inherited relation \"%s\" is not a table", |
1204 | 1204 | parent->relname))); |
1205 | 1205 | /* Permanent rels cannot inherit from temporary ones */ |
1206 | | -if (!istemp&&isTempNamespace(RelationGetNamespace(relation))) |
| 1206 | +if (!istemp&&relation->rd_istemp) |
1207 | 1207 | ereport(ERROR, |
1208 | 1208 | (errcode(ERRCODE_WRONG_OBJECT_TYPE), |
1209 | 1209 | errmsg("cannot inherit from temporary relation \"%s\"", |
@@ -2793,7 +2793,7 @@ ATRewriteTables(List **wqueue) |
2793 | 2793 | * Don't allow rewrite on temp tables of other backends ... their |
2794 | 2794 | * local buffer manager is not going to cope. |
2795 | 2795 | */ |
2796 | | -if (isOtherTempNamespace(RelationGetNamespace(OldHeap))) |
| 2796 | +if (RELATION_IS_OTHER_TEMP(OldHeap)) |
2797 | 2797 | ereport(ERROR, |
2798 | 2798 | (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
2799 | 2799 | errmsg("cannot rewrite temporary tables of other sessions"))); |
@@ -4603,16 +4603,16 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, |
4603 | 4603 | * backend has created in the temp table, because non-shared buffers are |
4604 | 4604 | * used for temp tables.) |
4605 | 4605 | */ |
4606 | | -if (isTempNamespace(RelationGetNamespace(pkrel))) |
| 4606 | +if (pkrel->rd_istemp) |
4607 | 4607 | { |
4608 | | -if (!isTempNamespace(RelationGetNamespace(rel))) |
| 4608 | +if (!rel->rd_istemp) |
4609 | 4609 | ereport(ERROR, |
4610 | 4610 | (errcode(ERRCODE_INVALID_TABLE_DEFINITION), |
4611 | 4611 | errmsg("cannot reference temporary table from permanent table constraint"))); |
4612 | 4612 | } |
4613 | 4613 | else |
4614 | 4614 | { |
4615 | | -if (isTempNamespace(RelationGetNamespace(rel))) |
| 4615 | +if (rel->rd_istemp) |
4616 | 4616 | ereport(ERROR, |
4617 | 4617 | (errcode(ERRCODE_INVALID_TABLE_DEFINITION), |
4618 | 4618 | errmsg("cannot reference permanent table from temporary table constraint"))); |
@@ -6690,7 +6690,7 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace) |
6690 | 6690 | * Don't allow moving temp tables of other backends ... their local buffer |
6691 | 6691 | * manager is not going to cope. |
6692 | 6692 | */ |
6693 | | -if (isOtherTempNamespace(RelationGetNamespace(rel))) |
| 6693 | +if (RELATION_IS_OTHER_TEMP(rel)) |
6694 | 6694 | ereport(ERROR, |
6695 | 6695 | (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), |
6696 | 6696 | errmsg("cannot move temporary tables of other sessions"))); |
@@ -6901,8 +6901,7 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent) |
6901 | 6901 | ATSimplePermissions(parent_rel, false); |
6902 | 6902 |
|
6903 | 6903 | /* Permanent rels cannot inherit from temporary ones */ |
6904 | | -if (!isTempNamespace(RelationGetNamespace(child_rel))&& |
6905 | | -isTempNamespace(RelationGetNamespace(parent_rel))) |
| 6904 | +if (parent_rel->rd_istemp&& !child_rel->rd_istemp) |
6906 | 6905 | ereport(ERROR, |
6907 | 6906 | (errcode(ERRCODE_WRONG_OBJECT_TYPE), |
6908 | 6907 | errmsg("cannot inherit from temporary relation \"%s\"", |
|