From: | Suresh Kumar R <suresh(dot)arsenal29(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Couldn't cast to record[] |
Date: | 2022-03-03 10:02:27 |
Message-ID: | CAH+y2+ZJcGmtO_qtyROHzoZYWKXn1tvVPKtQNDi1kxrwusM-Tg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi, I created an table with composite type array as datatype for one column.
When I query that table I need the pg_typeof(column) as record[] instead of
composite_type[].
I tried creating a separate function and returning record[], but below error
is thrown,
ERROR: PL/pgSQL functions cannot return type record[]
Below is sample for my requirement.
pali=# create type address as (number bigint, city varchar);
CREATE TYPE
pali=# create table person(name varchar, addresses address[]);
CREATE TABLE
pali=# insert into person values ('Michael', array[(82, 'NYC'),(24,
'Dunkirk')]::address[]);
INSERT 0 1
pali=# select pg_typeof(addresses::record[]) from person ;
pg_typeof
-----------
address[]
Here I expect record[] instead of address[].
Thanks in advance.
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2022-03-03 10:16:36 | Re: Couldn't cast to record[] |
Previous Message | Bharath Rupireddy | 2022-03-03 09:50:25 | Re: Postgres Wal Full |