I find the dependency is complex among header files in PG.   At the same
time,  I find the existing code still can use the header file very
cleanly/alphabetically.   so I probably missed some knowledge here.

for example,  when I want the LOCKTAG in .c file,   which is defined in
"storage/lock.h".  then I wrote the code like this:

#include "storage/lock.h"
...

LOCKTAG tag;


compile and get errors.

In file included from
.../src/include/storage/lock.h:21:
/../../../src/include/storage/lockdefs.h:50:2: error: unknown type name
      'TransactionId'
        TransactionId xid;                      /* xid of holder of
AccessExclusiveLock */

so I HAVE TO
1.  include the header file which contains the TransactionId
2.  add it before the lock.h.

normally I think we can add the dependency in lock.h directly to resolve
this issue.

so how can I include header file effectively ?

Thanks

Reply via email to