Re: interperting type oid in C code

Поиск
Список
Период
Сортировка
От Ken Been
Тема Re: interperting type oid in C code
Дата
Msg-id CANe84rz0Fb4R_c+r+AAF0XTSKRnUzanSnvo7zPiYTKaDQaY3MQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: interperting type oid in C code  (Melvin Davidson <melvin6925@gmail.com>)
Ответы Re: interperting type oid in C code
Re: interperting type oid in C code
Список pgsql-general
Thanks, but I actually wanted to do it from C code.  But anyway I think I found the answer: use the symbolic constants in catalog/pg_type.h, such as INT4OID.

On Mon, Oct 19, 2015 at 6:44 PM, Melvin Davidson <melvin6925@gmail.com> wrote:
SELECT typname
   FROM pg_type
 WHERE oid = Oid_x;

On Mon, Oct 19, 2015 at 2:36 PM, Ken Been <kbbeen@gmail.com> wrote:
I'm working on a foreign data wrapper and I want to switch based on the column type.  Specifically, if the column type in the external table is the same as in the (locally defined) foreign table then I can get some speedup for some types.

Through the ForeignScanState object I can get TupleDesc and AttInMetadata opjects, and through there I can get the Oid of the column type, but now I'm stumped.  How can I programmatically check whether Oid X refers to type int4, or whatever?

Thanks.



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.


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

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: Re: interperting type oid in C code
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: ERROR: tablespace "archive2" is not empty