Narrow the scope of the variable outputstr in logicalrep_write_tuple

Поиск
Список
Период
Сортировка
От japin
Тема Narrow the scope of the variable outputstr in logicalrep_write_tuple
Дата
Msg-id MEYP282MB16699FA4A7CD57EB250E871FB6A40@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответы Re: Narrow the scope of the variable outputstr in logicalrep_write_tuple  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Re: Narrow the scope of the variable outputstr in logicalrep_write_tuple  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

I find that the outputstr variable in logicalrep_write_tuple() only use in
`else` branch, I think we can narrow the scope, just like variable outputbytes
in `if` branch (for more readable).

        /*
         * Send in binary if requested and type has suitable send function.
         */
        if (binary && OidIsValid(typclass->typsend))
        {
            bytea      *outputbytes;
            int         len;

            pq_sendbyte(out, LOGICALREP_COLUMN_BINARY);
            outputbytes = OidSendFunctionCall(typclass->typsend, values[i]);
            len = VARSIZE(outputbytes) - VARHDRSZ;
            pq_sendint(out, len, 4);    /* length */
            pq_sendbytes(out, VARDATA(outputbytes), len);   /* data */
            pfree(outputbytes);
        }
        else
        {
            pq_sendbyte(out, LOGICALREP_COLUMN_TEXT);
            outputstr = OidOutputFunctionCall(typclass->typoutput, values[i]);
            pq_sendcountedtext(out, outputstr, strlen(outputstr), false);
            pfree(outputstr);
        }

Attached is a samll patch to fix it.

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.


Вложения

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

Предыдущее
От: Tatsuro Yamada
Дата:
Сообщение: Re: list of extended statistics on psql
Следующее
От: Luc Vlaming
Дата:
Сообщение: Re: Lazy JIT IR code generation to increase JIT speed with partitions