-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
  • 34,719
  • 24
  • 185
  • 251
Progs
  • 981
  • 6
  • 23
  • 61

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,198,228
  • 53
  • 572
  • 709