0

Using django, I added a new entry to my table. Now I want to delete it using PHPPgAdmin (postgresql), but I get No unique Identifier for this row error. What is the problem?

django automatically adds an auto-incrementing primary key, so I cannot figure out what the issue is?

I read this post, but it did not help. If you notice the image carefully, you will see that the primary key column label is id but not pk as it should be in django.

enter image description here

EDIT: No primary key is seen on table; enter image description here

But this is what django executes;

python manage.py sql auth

CREATE TABLE "auth_user" (
    "id" serial NOT NULL PRIMARY KEY,
    "password" varchar(128) NOT NULL,
    "last_login" timestamp with time zone NOT NULL,
    "is_superuser" boolean NOT NULL,
    "username" varchar(30) NOT NULL UNIQUE,
    "first_name" varchar(30) NOT NULL,
    "last_name" varchar(30) NOT NULL,
    "email" varchar(75) NOT NULL,
    "is_staff" boolean NOT NULL,
    "is_active" boolean NOT NULL,
    "date_joined" timestamp with time zone NOT NULL
)
;

EDIT: A screenshot from PHPPgAdmin, showing id as primary key enter image description here

Community
  • 1
  • 1
eagertoLearn
  • 9,772
  • 23
  • 80
  • 122

1 Answers1

0

I think this is a bug with phpPgAdmin.

I experienced a similar problem and went directly into psql (using the command ./manage.py dbshell).

I tried deleting the row in question, and received a more helpful error message than the one from phpPgAdmin. (In my case, that the row was being referenced by another table.)

I deleted the row referenced by the other table, and was then able to delete the row in question.

seddonym
  • 16,304
  • 6
  • 66
  • 71