Skip to content

postgres can't create index key when altering table #1253

@lenuse

Description

@lenuse

Describe the bug
Postgres reports an error when creating a new index
log:

ALTER TABLE "bbc_shop_account" ADD INDEX "password" ("password");
/* ERROR:  type "password" does not exist LINE 2:  ADD INDEX "password" ("password")^ */

table sql:
CREATE TABLE "bbc_shop_account" (
	"id" BIGINT NOT NULL DEFAULT 'nextval(''bbc_shop_account_id_seq''::regclass)',
	"email" VARCHAR(50) NULL DEFAULT 'NULL::character varying',
	"password" VARCHAR(50) NULL DEFAULT NULL,
	"salt" VARCHAR(50) NULL DEFAULT NULL,
	"disable" BOOLEAN NULL DEFAULT 'true',
	"created_at" TIMESTAMPTZ NULL DEFAULT NULL,
	"updated_at" TIMESTAMPTZ NULL DEFAULT NULL,
	"mobile" VARCHAR(20) NULL DEFAULT 'NULL::character varying',
	PRIMARY KEY ("id"),
	INDEX "idx_created_at" ("created_at"),
	INDEX "idx_account" ("email"),
	INDEX "password" ("password")
)
COMMENT='商家账号表'
;
COMMENT ON COLUMN "bbc_shop_account"."id" IS '主键';
COMMENT ON COLUMN "bbc_shop_account"."email" IS '登录账号';
COMMENT ON COLUMN "bbc_shop_account"."password" IS '登录密码';
COMMENT ON COLUMN "bbc_shop_account"."salt" IS '密码盐';
COMMENT ON COLUMN "bbc_shop_account"."disable" IS '是否有效';
COMMENT ON COLUMN "bbc_shop_account"."created_at" IS '创建时间';
COMMENT ON COLUMN "bbc_shop_account"."updated_at" IS '更新时间';
COMMENT ON COLUMN "bbc_shop_account"."mobile" IS '登录手机号';

Expected behavior
create new index key, sql is "create index password on bbc_shop_account (password);"

Screenshots
image

Environment:

  • OS: Windows 10
  • HeidiSQL version 11.1.0.6116
  • Database type and version PostgreSQL 12.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 8.3.0) 8.3.0, 64-bit
  • HeidiSQL Library: libpq-12.dll

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDefective behaviour in HeidiSQLnettype-postgresqlPostgreSQL specific issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions