Re: column ordering, was Re: [PATCHES] Enums patch v2

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: column ordering, was Re: [PATCHES] Enums patch v2
Дата
Msg-id 20061220141504.GG24675@kenobi.snowman.net
обсуждение исходный текст
Ответ на Re: column ordering, was Re: [PATCHES] Enums patch v2  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: column ordering, was Re: [PATCHES] Enums patch v2  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-hackers
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Stephen Frost <sfrost@snowman.net> writes:
> > Force references to go through macros which implement the lookup for the
> > appropriate type?  ie: LOGICAL_COL(table_oid,2) vs.
> > PHYSICAL_COL(table_oid,1)  Perhaps that's too simplistic.
>
> It doesn't really address the question of how you know which one to
> use at any particular line of code; or even more to the point, what
> mechanism will warn you if you use the wrong one.

That'd be the point of doing the typing, you then declare functions as
accepting the type and then if someone passes the wrong type to a
function the compiler will complain.  Inside of a particular function it
would hopefully be easier to keep it clear.  I'd think that most
functions would deal with one type or the other (which would be declared
in the arguments or in the local variables) and that functions which
have to deal with both would be able to keep them straight.

> My gut feeling about this is that we could probably enforce such a
> distinction if we were using C++, but while coding in C I have no
> confidence in it.  (And no, that's not a vote to move to C++ ...)

I need to go research what Linux does for this because aiui it's
pretty good about being able to enforce better type-checking than the
stock C types.  The only downside is that I *think* it might be a
GCC-only thing.  In that case I'd think we would still use it but build
some macros which essentially disable it for non-GCC compilers.  As a
mainly-for-developers compile-time check I think as long as a build-farm
member is running GCC and complaining when there are errors (and it can
be disabled on non-GCC compilers) we won't lose any portability from it.
Thanks,
    Stephen

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: column ordering, was Re: [PATCHES] Enums patch v2
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: column ordering, was Re: [PATCHES] Enums patch v2