Re: object_classes array is broken, again

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: object_classes array is broken, again
Дата
Msg-id 558DD0BF.1000407@BlueTreble.com
обсуждение исходный текст
Ответ на object_classes array is broken, again  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: object_classes array is broken, again
Список pgsql-hackers
On 6/24/15 2:11 PM, Robert Haas wrote:
> Fixing this is easy, but ISTM that we need to insert some sort of a
> guard to prevent people from continuing to forget this, because it's
> apparently quite easy to do.  Perhaps add_object_address should
> Assert(OidIsValid(object_classes[oclass])), plus a (static?) assert
> someplace checking that OidIsValid(object_classes[MAX_OCLASS - 1])?

I tried doing this and I'm getting a "static_assert expression is not an
integral constant expression" error, even when I reduce it to a simple
constant comparison. Maybe I'm just doing something dumb...

If I replace the StaticAssert with
Assert(OidIsValid(object_classes[MAX_OCLASS - 1])) it works find and
initdb will fail if that assert trips.

I've attached the broken StaticAssert version. Also added a warning
comment to the enum.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Data in Trouble? Get it in Treble! http://BlueTreble.com

Вложения

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: BRIN index bug due to WAL refactoring
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: pg_stat_*_columns?