-2

This is really annoying me, since it's a really simple catalog from a database but when I try to insert I get this error:

ERROR: array value must start with "{" or dimension information LINE 1: INSERT INTO "catDelegacion" (delegacion) VALUES ('someData')... ^ ********** Error **********

ERROR: array value must start with "{" or dimension information SQL state: 22P02 Character: 50

this is my code:

INSERT INTO "catDelegacion" (delegacion) VALUES ('someData');

and the definition of my table:

CREATE TABLE "catDelegacion"
(
  id_delegacion serial NOT NULL,
  delegacion character varying[],
  CONSTRAINT "catDelegacion_pkey" PRIMARY KEY (id_delegacion)
)

I really don't know where is the error, also tried:

  INSERT INTO "catDelegacion" (delegacion) VALUES ("someData");
Cœur
  • 37,241
  • 25
  • 195
  • 267
Progs
  • 1,059
  • 7
  • 27
  • 63

1 Answers1

2

You have declared delegation to be an array (of strings), not a string. Try this definition:

CREATE TABLE catDelegacion (
  id_delegacion serial NOT NULL,
  delegacion character varying,
  CONSTRAINT catDelegacion_pkey PRIMARY KEY (id_delegacion)
);

INSERT INTO catDelegacion(delegacion)
  VALUES ('someData');
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786