Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h

Поиск
Список
Период
Сортировка
От Julien Rouhaud
Тема Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h
Дата
Msg-id 20220116151835.ro3b3shvsmmdeyt4@nol
обсуждение исходный текст
Ответ на Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h  (Mario Emmenlauer <mario@emmenlauer.de>)
Ответы Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h  (Mario Emmenlauer <mario@emmenlauer.de>)
Список pgsql-bugs
Hi,

On Sun, Jan 16, 2022 at 04:06:45PM +0100, Mario Emmenlauer wrote:
> 
> 
> Actually I do not really mean to include `postgres.h`. But I do want
> to identify result types with `Oid vOID = ::PQftype(mResult.get(), vColumn);`
> to check the result type. And the types seem to be defined in header
> `catalog/pg_type.h` which only worked when `postgres.h` was included before.
> 
> I guess I'm off the standard track here. Its not completely mandatory for
> me to identify the result types. But it was quite nice to be able to do
> so.
> 
> Is this actually unsupported? Or am I doing something wrong?

It's supported and multiple clien-side programs access those constants.
However you don't need to include postgres.h for that.  There are examples in
the tree that relies on OID defines if you want to check how it's done, for
instance src/bin/pg_dump/pg_dump.c.

Note that the OIDs aren't in pg_type.h anymore since pg 11.  Are you still
compiling against pg 10 or less?



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

Предыдущее
От: Mario Emmenlauer
Дата:
Сообщение: Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h
Следующее
От: Mario Emmenlauer
Дата:
Сообщение: Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h