Re: tablecmds.c/MergeAttributes() cleanup

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: tablecmds.c/MergeAttributes() cleanup
Дата
Msg-id 20230829204008.GA2161940@nathanxps13
обсуждение исходный текст
Ответ на Re: tablecmds.c/MergeAttributes() cleanup  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: tablecmds.c/MergeAttributes() cleanup  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
On Tue, Aug 29, 2023 at 08:44:02PM +0200, Alvaro Herrera wrote:
> On 2023-Aug-29, Nathan Bossart wrote:
>> My compiler is complaining about 1fa9241b:
>> 
>> ../postgresql/src/backend/commands/sequence.c: In function ‘DefineSequence’:
>> ../postgresql/src/backend/commands/sequence.c:196:21: error: ‘coldef’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
>>   196 |   stmt->tableElts = lappend(stmt->tableElts, coldef);
>>       |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 
>> This went away when I added a default case that ERROR'd or initialized
>> coldef to NULL.
> 
> Makes sense.  However, maybe we should replace those ugly defines and
> their hardcoded values in DefineSequence with a proper array with their
> names and datatypes.

That might be an improvement, but IIUC you'd still need to enumerate all of
the columns or data types to make sure you use the right get-Datum
function.  It doesn't help that last_value uses Int64GetDatumFast and
log_cnt uses Int64GetDatum.  I could be missing something, though.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: tablecmds.c/MergeAttributes() cleanup
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: Wrong usage of pqMsg_Close message code?