@@ -160,7 +160,6 @@ PathmanDoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed)
160160bool is_from = stmt -> is_from ;
161161bool pipe = (stmt -> filename == NULL );
162162Relation rel ;
163- Oid relid ;
164163Node * query = NULL ;
165164List * range_table = NIL ;
166165
@@ -194,8 +193,6 @@ PathmanDoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed)
194193/* Open the relation (we've locked it in is_pathman_related_copy()) */
195194rel = heap_openrv (stmt -> relation ,NoLock );
196195
197- relid = RelationGetRelid (rel );
198-
199196rte = makeNode (RangeTblEntry );
200197rte -> rtekind = RTE_RELATION ;
201198rte -> relid = RelationGetRelid (rel );
@@ -280,7 +277,6 @@ PathmanDoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed)
280277Assert (stmt -> query );
281278
282279query = stmt -> query ;
283- relid = InvalidOid ;
284280rel = NULL ;
285281}
286282
@@ -291,7 +287,7 @@ PathmanDoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed)
291287Assert (rel );
292288
293289/* check read-only transaction and parallel mode */
294- if (XactReadOnly && !rel -> rd_islocaltemp )
290+ if (XactReadOnly && rel && !rel -> rd_islocaltemp )
295291PreventCommandIfReadOnly ("PATHMAN COPY FROM" );
296292PreventCommandIfParallelMode ("PATHMAN COPY FROM" );
297293