Re: pgsql: dblink: Replace some macros by static functions

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: dblink: Replace some macros by static functions
Date: 2017-04-05 13:04:21
Message-ID: d86645b3-44cb-4155-719c-66bcdeba3fe0@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 3/13/17 15:58, Tom Lane wrote:
> In the same vein, I think this bit in dblink_open is pretty poor coding
> practice:
>
> if (!rconn || !rconn->conn)
> dblink_conn_not_avail(conname);
> else
> conn = rconn->conn;
>
> as it expects both the compiler and the reader to understand that
> we will not proceed without "conn" getting a value. I see that
> that was band-aided around by initializing conn to NULL, but that's a
> crummy way of suppressing uninitialized-variable warnings, because it
> will mask even actual errors. Far better would be to remove the dummy
> initialization and write
>
> if (!rconn || !rconn->conn)
> dblink_conn_not_avail(conname);
> conn = rconn->conn;

fixed

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Kevin Grittner 2017-04-05 15:12:34 pgsql: Add isolation test for SERIALIZABLE READ ONLY DEFERRABLE.
Previous Message Peter Eisentraut 2017-04-05 13:03:46 pgsql: dblink: Small code rearrangement for clarity