SQL错误'列“ zona”的类型为box,但表达式的类型为record'

问题描述 投票:0回答:1

我是SQL的新手,我已经看到了与此类似的问题,但是我无法仅通过查看这些解决方案来解决问题。(在postgres上工作)

我有桌子异常:

create table anomalia(
  id integer,
  zona box not null,
  imagem varchar(50) not null,
  lingua char(3) not null,
  ts timestamp not null,
  descricao text not null,
  tem_anomalia_redacao boolean not null,
  primary key(id)
);

以及当我尝试:

insert into anomalia values (22, ((2, 4), (8, 9)), 'imagem2.png', 'por', '2003-09-21 22:54:56', 'Texto muito pequeno', TRUE);

我收到此错误:

psql:schema.sql:129: ERROR:  column "zona" is of type box but expression is of type record                           
LINE 1: insert into anomalia values (22, ((2, 4), (8, 9)), 'imagem2....

根据我的阅读,问题很可能与括号有关,但我无法弄清楚。如果您想帮助您,将非常感谢!

sql postgresql record
1个回答
0
投票

简单地将zona字段的值括在单引号中,如:

insert into anomalia values (22, '((2, 4), (8, 9))', 'imagem2.png', 'por', '2003-09-21 22:54:56', 'Texto muito pequeno', TRUE);
© www.soinside.com 2019 - 2024. All rights reserved.