* RelationBuildLocalRelation * Build a relcache entry for an about-to-be-created relation, * and enter it into the relcache. */
| 3610 | * and enter it into the relcache. |
| 3611 | */ |
| 3612 | Relation |
| 3613 | RelationBuildLocalRelation(const char *relname, |
| 3614 | Oid relnamespace, |
| 3615 | TupleDesc tupDesc, |
| 3616 | Oid relid, |
| 3617 | Oid accessmtd, |
| 3618 | Oid relfilenode, |
| 3619 | Oid reltablespace, |
| 3620 | bool shared_relation, |
| 3621 | bool mapped_relation, |
| 3622 | char relpersistence, |
| 3623 | char relkind) |
| 3624 | { |
| 3625 | Relation rel; |
| 3626 | MemoryContext oldcxt; |
| 3627 | int natts = tupDesc->natts; |
| 3628 | int i; |
| 3629 | bool has_not_null; |
| 3630 | bool nailit; |
| 3631 | |
| 3632 | AssertArg(natts >= 0); |
| 3633 | |
| 3634 | /* |
| 3635 | * check for creation of a rel that must be nailed in cache. |
| 3636 | * |
| 3637 | * XXX this list had better match the relations specially handled in |
| 3638 | * RelationCacheInitializePhase2/3. |
| 3639 | */ |
| 3640 | switch (relid) |
| 3641 | { |
| 3642 | case DatabaseRelationId: |
| 3643 | case AuthIdRelationId: |
| 3644 | case AuthMemRelationId: |
| 3645 | case AuthTimeConstraintRelationId: |
| 3646 | case RelationRelationId: |
| 3647 | case AttributeRelationId: |
| 3648 | case ProcedureRelationId: |
| 3649 | case TypeRelationId: |
| 3650 | nailit = true; |
| 3651 | break; |
| 3652 | default: |
| 3653 | nailit = false; |
| 3654 | break; |
| 3655 | } |
| 3656 | |
| 3657 | /* |
| 3658 | * check that hardwired list of shared rels matches what's in the |
| 3659 | * bootstrap .bki file. If you get a failure here during initdb, you |
| 3660 | * probably need to fix IsSharedRelation() to match whatever you've done |
| 3661 | * to the set of shared relations. |
| 3662 | */ |
| 3663 | if (shared_relation != IsSharedRelation(relid)) |
| 3664 | elog(ERROR, "shared_relation flag for \"%s\" does not match IsSharedRelation(%u)", |
| 3665 | relname, relid); |
| 3666 | |
| 3667 | /* Shared relations had better be mapped, too */ |
| 3668 | Assert(mapped_relation || !shared_relation); |
| 3669 |
no test coverage detected