Re: [COMMITTERS] pgsql: dblink: Replace some macros by static functions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [COMMITTERS] pgsql: dblink: Replace some macros by static functions
Дата
Msg-id 30881.1489435086@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: dblink: Replace some macros by staticfunctions  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: pgsql: dblink: Replace some macros by staticfunctions  (Peter Eisentraut <peter.eisentraut@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


В списке pgsql-committers по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: [COMMITTERS] pgsql: Include array size in forward declaration.
Следующее
От: Michael Meskes
Дата:
Сообщение: [COMMITTERS] pgsql: Ecpg should support COMMIT PREPARED and ROLLBACK PREPARED.