programmatically retrieve details of a custom Postgres type

Поиск
Список
Период
Сортировка
От Konstantin Izmailov
Тема programmatically retrieve details of a custom Postgres type
Дата
Msg-id CAAw-Mse9DJf1wUa650jix04VKWx=r-u8OkqX=XHJBeLDo42eXQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: programmatically retrieve details of a custom Postgres type  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: programmatically retrieve details of a custom Postgres type  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-general
Hello,
I was unable to find how to get column names, sizes and types for a given composite type.

Example. For a type defines as:
  CREATE TYPE inventory_item AS (
  name text,
  supplier_id integer,
  price numeric
);

I have a plpgsql stored proc that returns SETOF inventory_item (i.e. there is no table with a column of this type).

I looked into the pg_type table but it only contains oid and typrelid for the inventory_item type. I need a query that returns information about structure of the composite type, i.e.:
  ColumnName  |  ColumnType  |  ColumnSize
  name             | text                | -1
  supplier_id      | integer           | 4
  price              | numeric          | 16

Is this possible? I'm executing queries via libpq...

Thank you!

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

Предыдущее
От: Brad White
Дата:
Сообщение: Re: Setting up replication on Windows, v9.4
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: programmatically retrieve details of a custom Postgres type