Datum as struct

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Datum as struct
Дата
Msg-id 8246d7ff-f4b7-4363-913e-827dadfeb145@eisentraut.org
обсуждение исходный текст
Ответы Re: Datum as struct
Список pgsql-hackers
Another draft patch set that I had lying around that was mentioned in [0].

The idea is to change Datum to a struct so that you can no longer rely 
on it being implicitly convertable to other C types, which enforces use 
of proper DatumGet*() and *GetDatum() functions, which might ultimately 
help with portability and robustness and the like.  (An alternative idea 
is to make Datum a union so that you don't need so many casts to begin 
with.  But this has a lot of the same issues, so it can be considered 
implicitly here.)

The first three patches clean up the use of the conversion functions. 
Some are missing, some are superfluous, some are used the wrong way 
around (!!).

The fourth patch tidies up the use of varatt.h macros.  These should 
arguably not be used on Datum values but instead be converted with 
DatumGetPointer().  This is very similar to the patch that I also 
included in the thread "Convert varatt.h macros to static inline 
functions" that I just posted.

The fifth patch cleans up some untidy use of hash functions with the 
wrong argument type.

The last patch is the actual conversion.  As you can see there, and as 
was also mentioned in [0], it's quite a bit of churn.  I'm not seriously 
proposing it at this point, but maybe it can serve as a guide for 
refactoring some of the interfaces to make the impact smaller, or 
something like that.

But I think the patches 0001 through 0005 are useful now.

I tested this against the original patch in [0].  It fixes some of the 
issues discussed there but not all of them.


[0]: 
https://www.postgresql.org/message-id/flat/1749799.1752797397%40sss.pgh.pa.us
Вложения

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