Unused variable in postgres_fdw/deparse.c - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Unused variable in postgres_fdw/deparse.c
Date
Msg-id 20161026.094951.236564575.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
Responses Re: Unused variable in postgres_fdw/deparse.c  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Re: Unused variable in postgres_fdw/deparse.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello, compiler complains about unused variable during build
postgres_fdw without assertions (!--enable-cassert).

deparse.c: In function ‘deparseFromExpr’:
deparse.c:1029:14: warning: unused variable ‘foreignrel’ [-Wunused-variable] RelOptInfo *foreignrel =
context->foreignrel;            ^~~~~~~~~~
 

The attched patch removes it and moves into the assertion below it.

regards,

diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index 8da8c11..450693a 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -1026,11 +1026,10 @@ static voiddeparseFromExpr(List *quals, deparse_expr_cxt *context){    StringInfo    buf =
context->buf;
-    RelOptInfo *foreignrel = context->foreignrel;    RelOptInfo *scanrel = context->scanrel;    /* For upper
relations,scanrel must be either a joinrel or a baserel */
 
-    Assert(foreignrel->reloptkind != RELOPT_UPPER_REL ||
+    Assert(context->foreignrel->reloptkind != RELOPT_UPPER_REL ||           scanrel->reloptkind == RELOPT_JOINREL ||
       scanrel->reloptkind == RELOPT_BASEREL); 

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Wraparound warning
Next
From: Amit Langote
Date:
Subject: Re: Declarative partitioning - another take