Re: Couldn't cast to record[]

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Couldn't cast to record[]
Дата
Msg-id 4071820.1646494169@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Couldn't cast to record[]  (Suresh Kumar R <suresh.arsenal29@gmail.com>)
Список pgsql-general
Suresh Kumar R <suresh.arsenal29@gmail.com> writes:
>    I needed this because, I use postgres backend along with golang using
> pgx driver. When i query address i need to specify OID of
> address[](composite type). In my case i couldnt find the oid of that type
> since its dynamic.

The usual advice is to look it up on the fly.  As an example:

regression=# create type address as (f1 text, f2 text);
CREATE TYPE
regression=# select 'address[]'::regtype;
  regtype  
-----------
 address[]
(1 row)

regression=# select 'address[]'::regtype::oid;
  oid   
--------
 127056
(1 row)

If the client-side stack wants a type OID for a result column,
it's unlikely to be satisfied with a pseudotype OID anyway.
That provides next-to-no useful information about how to
interpret values.  Are you sure you can't just leave the type
unspecified (e.g. zero) in whatever API is giving you trouble?

            regards, tom lane



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

Предыдущее
От: obi reddy
Дата:
Сообщение: REG:DR DRILL
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Interesting fail when migrating Pg from Ubuntu Bionic to Focal