From 6f018c6dda201818251d8ead03866289b6b7e1c8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 14 Mar 2012 22:44:40 +0200 Subject: [PATCH] COPY: Add an assertion This is for tools such as Coverity that don't know that the grammar enforces that the case of not having a relation (but instead a query) cannot happen in the FROM case. --- src/backend/commands/copy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 110480f6ea..517660d373 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -797,6 +797,8 @@ DoCopy(const CopyStmt *stmt, const char *queryString) if (is_from) { + Assert(rel); + /* check read-only transaction */ if (XactReadOnly && rel->rd_backend != MyBackendId) PreventCommandIfReadOnly("COPY FROM"); -- 2.40.0