---------------------------------------------------------------- * ExecOpenScanRelation * * Open the heap relation to be scanned by a base-level scan plan node. * This should be called during the node's ExecInit routine. * ---------------------------------------------------------------- */
| 774 | * ---------------------------------------------------------------- |
| 775 | */ |
| 776 | Relation |
| 777 | ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags) |
| 778 | { |
| 779 | Relation rel; |
| 780 | |
| 781 | /* Open the relation. */ |
| 782 | rel = ExecGetRangeTableRelation(estate, scanrelid); |
| 783 | |
| 784 | /* |
| 785 | * Complain if we're attempting a scan of an unscannable relation, except |
| 786 | * when the query won't actually be run. This is a slightly klugy place |
| 787 | * to do this, perhaps, but there is no better place. |
| 788 | */ |
| 789 | if ((eflags & (EXEC_FLAG_EXPLAIN_ONLY | EXEC_FLAG_WITH_NO_DATA)) == 0 && |
| 790 | !RelationIsScannable(rel)) |
| 791 | ereport(ERROR, |
| 792 | (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), |
| 793 | errmsg("materialized view \"%s\" has not been populated", |
| 794 | RelationGetRelationName(rel)), |
| 795 | errhint("Use the REFRESH MATERIALIZED VIEW command."))); |
| 796 | |
| 797 | return rel; |
| 798 | } |
| 799 | |
| 800 | /* |
| 801 | * ExecInitRangeTable |
no test coverage detected