]> granicus.if.org Git - postgresql/commitdiff
COPY: Add an assertion
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 14 Mar 2012 20:44:40 +0000 (22:44 +0200)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 14 Mar 2012 20:44:40 +0000 (22:44 +0200)
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

index 110480f6eae3a112d454c536ae2618f109c612d2..517660d3735d75724e1038c14823ab13b6f81ce4 100644 (file)
@@ -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");