【问题标题】:column "foo" is of type test12.test_type[] but expression is of type record[]列“foo”的类型为 test12.test_type[],但表达式的类型为 record[]
【发布时间】:2019-04-10 09:10:59
【问题描述】:

我正在尝试在 Greenplum 中创建一个复合类型并使用该类型的数组。但是当我尝试向表中插入数据时,它总是说

列“foo”的类型为 test11.test_type[],但表达式的类型为 record[]。
提示:您将需要重写或强制转换表达式。 SQL 状态:42804"。

我已经尝试了将数组插入greenplum的所有方法。例如。 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);

【问题讨论】:

  • 我不知道 greenplum,但在 Postgres 中你会使用 array[(3,4),(2,4)]::test123[]
  • 感谢工作。

标签: greenplum


【解决方案1】:

我不能说这是否适用于 Greenplum,但您可以尝试:

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

【讨论】:

    猜你喜欢
    • 2018-03-31
    • 1970-01-01
    • 2015-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 2011-05-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多