Errors with creating index on PostgreSQL

Acuna posted 1 year ago in General

Hello! I'm trying to turn on PostgreSQL, but when I create a table with index, looks like

CREATE TABLE IF NOT EXISTS "labels" ("id" SERIAL, "name" VARCHAR(255) NOT NULL DEFAULT E'', PRIMARY KEY ("id"), INDEX "name" ("name"));

I have a error

Type modifier is not allowed for type "name"

But when I create it directly by query

CREATE INDEX "name" ON "labels" ("name");

for example, all is working well, but its name seems empty, looks like

INDEX "" ("name")

So of course I get a error

ERROR: zero-length delimited identifier at or near """"LINE 2: DROP INDEX ""

When trying to edit its name manually or edit the table. It trying to drop this index by name, but it's empty.

Is it really to fix it, because now PostgreSQL seems unworkable, but there's so actually and using in known big projects over the world.

Thanks a lot!

Please login to leave a reply, or register at first.