Re: Using defines for protocol characters

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Using defines for protocol characters
Дата
Msg-id 20230807091044.jjgsl2rgheazaung@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Using defines for protocol characters  (Peter Smith <smithpb2250@gmail.com>)
Ответы Re: Using defines for protocol characters  (Dave Cramer <davecramer@gmail.com>)
Список pgsql-hackers
On 2023-Aug-07, Peter Smith wrote:

> I guess, your patch would not be much different; you can still have
> all the nice names and assign the appropriate values to the enum
> values same as now, but using an enum you might also gain
> type-checking in the code and also get warnings for the "switch"
> statements if there are any cases accidentally omitted.

Hmm, I think omitting a 'default' clause (which is needed when you want
warnings for missing clauses) in a switch that handles protocol traffic
is not great, because the switch would misbehave when the network
counterpart sends a broken message.  I'm not sure we want to do that.
It could become a serious security problem if confronted with a
malicious libpq.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: [PoC] pg_upgrade: allow to upgrade publisher node
Следующее
От: Thomas Munro
Дата:
Сообщение: Minor configure/meson cleanup