Search code examples
greenplum

column "foo" is of type test12.test_type[] but expression is of type record[]


I am trying to create a composite TYPE in Greenplum and using that an array of that TYPE. But when I try to insert data into table, it always says

column "foo" is of type test11.test_type[] but expression is of type record[].
HINT: You will need to rewrite or cast the expression. SQL state: 42804".

I have tried all the ways of inserting an array into greenplum. for eg. array[(3,4),(2,4)] and '{(1,3), (1,2)}'

create type test11.test123 as (a1 int, a2 int);

create table test11.test(faa qlake_streaming_ioc.test11[], aa int);

insert into test(faa, aa) values (array[(3,4),(2,4)] , 3);

Solution

  • I can't say if that works on Greenplum, but you can try:

    INSERT INTO tab (foo)
       VALUES (ARRAY[(3,4), (2,4)]::test11.test_type[]);