pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: dblink: Replace some macros by static functions
5+ messages / 4 participants
[nested] [flat]

* pgsql: dblink: Replace some macros by static functions
@ 2017-03-10 14:46 Peter Eisentraut <peter_e@gmx.net>
  2017-03-12 21:44 ` Re: pgsql: dblink: Replace some macros by static functions David Rowley <david.rowley@2ndquadrant.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Eisentraut @ 2017-03-10 14:46 UTC (permalink / raw)
  To: pgsql-committers

dblink: Replace some macros by static functions

Also remove some unused code and the no longer useful dblink.h file.

Reviewed-by: Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/acaf7ccb94a3916ea83712671a3563f0eb595558

Modified Files
--------------
contrib/dblink/dblink.c | 290 +++++++++++++++++++++++-------------------------
contrib/dblink/dblink.h |  39 -------
2 files changed, 137 insertions(+), 192 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: dblink: Replace some macros by static functions
  2017-03-10 14:46 pgsql: dblink: Replace some macros by static functions Peter Eisentraut <peter_e@gmx.net>
@ 2017-03-12 21:44 ` David Rowley <david.rowley@2ndquadrant.com>
  2017-03-13 19:45   ` Re: pgsql: dblink: Replace some macros by static functions Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 5+ messages in thread

From: David Rowley @ 2017-03-12 21:44 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-committers

On 11 March 2017 at 03:46, Peter Eisentraut <peter_e@gmx.net> wrote:

> dblink: Replace some macros by static functions
>
> Also remove some unused code and the no longer useful dblink.h file.
>
> Reviewed-by: Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
>
> Branch
> ------
> master
>
> Details
> -------
> http://git.postgresql.org/pg/commitdiff/acaf7ccb94a3916ea83712671a3563
> f0eb595558
>
> Modified Files
> --------------
> contrib/dblink/dblink.c | 290 +++++++++++++++++++++++-------
> ------------------
> contrib/dblink/dblink.h |  39 -------
> 2 files changed, 137 insertions(+), 192 deletions(-)
>

Hi Peter,

Please accept a small patch which fixes a new compiler warning which
started as a result of this commit.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Attachments:

dblink_compiler_warning_fix.patch (application/octet-stream, 442B) download diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index eba6f27..c2e08f1 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -225,8 +225,9 @@ dblink_get_named_conn(const char *conname) remoteConn *rconn = getConnectionByName(conname); if (rconn) return rconn->conn; - else - dblink_conn_not_avail(conname); + + dblink_conn_not_avail(conname); + return NULL; /* keep compiler quiet */ } static void
^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: pgsql: dblink: Replace some macros by static functions
  2017-03-10 14:46 pgsql: dblink: Replace some macros by static functions Peter Eisentraut <peter_e@gmx.net>
  2017-03-12 21:44 ` Re: pgsql: dblink: Replace some macros by static functions David Rowley <david.rowley@2ndquadrant.com>
@ 2017-03-13 19:45   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-03-13 19:58     ` Re: pgsql: dblink: Replace some macros by static functions Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Eisentraut @ 2017-03-13 19:45 UTC (permalink / raw)
  To: David Rowley <david.rowley@2ndquadrant.com>; +Cc: pgsql-committers

On 3/12/17 17:44, David Rowley wrote:
> Please accept a small patch which fixes a new compiler warning which
> started as a result of this commit.

Done.

Which compiler is that?


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


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: dblink: Replace some macros by static functions
  2017-03-10 14:46 pgsql: dblink: Replace some macros by static functions Peter Eisentraut <peter_e@gmx.net>
  2017-03-12 21:44 ` Re: pgsql: dblink: Replace some macros by static functions David Rowley <david.rowley@2ndquadrant.com>
  2017-03-13 19:45   ` Re: pgsql: dblink: Replace some macros by static functions Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2017-03-13 19:58     ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-04-05 13:04       ` Re: pgsql: dblink: Replace some macros by static functions Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2017-03-13 19:58 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: David Rowley <david.rowley@2ndquadrant.com>; pgsql-committers

Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 3/12/17 17:44, David Rowley wrote:
>> Please accept a small patch which fixes a new compiler warning which
>> started as a result of this commit.

> Done.

> Which compiler is that?

Any compiler that didn't support pg_attribute_noreturn() could be expected
to whine about the original coding.

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;


			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: dblink: Replace some macros by static functions
  2017-03-10 14:46 pgsql: dblink: Replace some macros by static functions Peter Eisentraut <peter_e@gmx.net>
  2017-03-12 21:44 ` Re: pgsql: dblink: Replace some macros by static functions David Rowley <david.rowley@2ndquadrant.com>
  2017-03-13 19:45   ` Re: pgsql: dblink: Replace some macros by static functions Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2017-03-13 19:58     ` Re: pgsql: dblink: Replace some macros by static functions Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-04-05 13:04       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Peter Eisentraut @ 2017-04-05 13:04 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David Rowley <david.rowley@2ndquadrant.com>; 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


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2017-04-05 13:04 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 14:46 pgsql: dblink: Replace some macros by static functions Peter Eisentraut <peter_e@gmx.net>
2017-03-12 21:44 ` David Rowley <david.rowley@2ndquadrant.com>
2017-03-13 19:45   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2017-03-13 19:58     ` Tom Lane <tgl@sss.pgh.pa.us>
2017-04-05 13:04       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox