# Postgres Relation Does not Exist

**URL:** <https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695>\
**Category:** Using the ORM\
**Created:** [November 27, 2021, 11:42am UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695 "2021-11-27T11:42:29Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![firaki12345](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/firaki12345/32/4251_2.png) [@firaki12345](https://forum.djangoproject.com/u/firaki12345)\
**Post date:** [November 27, 2021, 11:42am UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/1 "2021-11-27T11:42:29Z")

</div>

OK so i have the following settings and models in my django file.

**Settings.py file**

```auto
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',

```

```
    'NAME': 'prods1',

    'USER': 'Username',

    'PASSWORD': 'Password',

    'HOST': 'localhost',

    'PORT': 5432,
}

```

}

**Models FIle:**

`class Retailers(models.Model):`

```
Links = models.CharField(max_length=500,unique=True)

Title = models.CharField(max_length=300)

Images = models.TextField()

Color = models.CharField(max_length=40)

def __str__ (self):
	
	return self.Title

```

**Now i have even entered the data into the models and have even shows it on my Test website.**

but now i went to check my data on PostgreSQL (Through terminal)

But it says relation does not exist. Please Help

**Screenshots For Proof:**

 ![](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/b/b6c0223c3d877c90aa1ec921f107226bb1d7d4bd.png)

 ![](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/6/612ed2efc3903a46c3f1e49c10f444bb9da85052.png)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 27, 2021, 12:26pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/2 "2021-11-27T12:26:04Z")

</div>

Capitalization is significant. Compare what you’ve entered with what PostgreSQL is telling you is the name of the table. (Also note that this is not a Django issue.)

---

<div class="post-metadata">

**Author:** ![firaki12345](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/firaki12345/32/4251_2.png) [@firaki12345](https://forum.djangoproject.com/u/firaki12345)\
**Post date:** [November 27, 2021, 12:54pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/3 "2021-11-27T12:54:23Z")

</div>

hi yes i tried without capitalization and with it, still get this error.

Well django shoes the data on the website, i was just trying to show it in my terminal, but relation does not exist ☹

---

<div class="post-metadata">

**Author:** ![firaki12345](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/firaki12345/32/4251_2.png) [@firaki12345](https://forum.djangoproject.com/u/firaki12345)\
**Post date:** [November 27, 2021, 12:57pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/4 "2021-11-27T12:57:18Z")

</div>

i also deleted the database removed migrations, made the database again, and inserted data, but still same problem

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 27, 2021, 12:58pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/5 "2021-11-27T12:58:43Z")

</div>

Look **really carefully** at the capitalization of the table name compared to what you entered.

---

<div class="post-metadata">

**Author:** ![firaki12345](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/firaki12345/32/4251_2.png) [@firaki12345](https://forum.djangoproject.com/u/firaki12345)\
**Post date:** [November 27, 2021, 1:01pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/6 "2021-11-27T13:01:05Z")

</div>

yes i tried Prods\_retailers.

does not work ☹

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 27, 2021, 1:03pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/7 "2021-11-27T13:03:28Z")

</div>

Ok, do me a favor please - copy/paste the _text_ from the `\dt` command as well as the _text_ from the select statement, not an image. (It’s going to be easier to quote / demonstrate what’s happening here that way.)

---

<div class="post-metadata">

**Author:** ![firaki12345](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/firaki12345/32/4251_2.png) [@firaki12345](https://forum.djangoproject.com/u/firaki12345)\
**Post date:** [November 27, 2021, 1:06pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/8 "2021-11-27T13:06:09Z")

</div>

Alrite, Here it is

Prods\_retailers

select \* from Prods\_retailers;

prods1=# select \* from Prods\_retailers;  
ERROR: relation “prods\_retailers” does not exist  
LINE 1: select \* from Prods\_retailers;

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 27, 2021, 1:06pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/9 "2021-11-27T13:06:50Z")

</div>

> [@firaki12345](#):
>
> prods1=# select \* from Prods\_retailers;  
> ERROR: relation “prods\_retailers” does not exist

Notice what you entered vs what PSQL iterprets it as.

The PSQL docs will tell you that unquoted names are case insensitive. You need to specify the table name quoted in this case.  
e.g. `select * from "Prods_retailers";`

---

<div class="post-metadata">

**Author:** ![firaki12345](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/firaki12345/32/4251_2.png) [@firaki12345](https://forum.djangoproject.com/u/firaki12345)\
**Post date:** [November 27, 2021, 1:07pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/10 "2021-11-27T13:07:35Z")

</div>

```auto
prods1=# \dt
                  List of relations
 Schema | Name | Type | Owner  
--------+----------------------------+-------+--------
 public | Prods_retailers | table | firaki
 public | auth_group | table | firaki
 public | auth_group_permissions | table | firaki
 public | auth_permission | table | firaki
 public | auth_user | table | firaki
 public | auth_user_groups | table | firaki
 public | auth_user_user_permissions | table | firaki
 public | django_admin_log | table | firaki
 public | django_content_type | table | firaki
 public | django_migrations | table | firaki
 public | django_session | table | firaki
(11 rows)

```

```auto
prods1=# select * from Prods_retailers;
ERROR: relation "prods_retailers" does not exist
LINE 1: select * from Prods_retailers;

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 27, 2021, 1:09pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/11 "2021-11-27T13:09:53Z")

</div>

Sorry, timing issue - see response above your most recent comment.

---

<div class="post-metadata">

**Author:** ![firaki12345](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/firaki12345/32/4251_2.png) [@firaki12345](https://forum.djangoproject.com/u/firaki12345)\
**Post date:** [November 27, 2021, 1:15pm UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/12 "2021-11-27T13:15:41Z")

</div>

thank you thank you so much, God bless you 🙂

---

<div class="post-metadata">

**Author:** ![lordihm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/lordihm/32/13548_2.png) [@lordihm](https://forum.djangoproject.com/u/lordihm)\
**Post date:** [May 3, 2023, 9:20am UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/13 "2023-05-03T09:20:57Z")

</div>

visit this link, I believe that the answer provided will help you:

> <https://stackoverflow.com/questions/46391330/relation-does-not-exist-error-in-django/76162206#76162206>

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 3, 2023, 11:07am UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/14 "2023-05-03T11:07:39Z")

</div>

@lordihm Welcome to the Django forum!

Two notes I’d like to pass along -

First, this issue was resolved - see the message directly above your post.

Second, the linked post doesn’t have anything to do with the symptoms as fully described here in this thread and does not provide additional useful information to those reading this thread in the future.

---

<div class="post-metadata">

**Author:** ![lordihm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/lordihm/32/13548_2.png) [@lordihm](https://forum.djangoproject.com/u/lordihm)\
**Post date:** [May 4, 2023, 8:18am UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/15 "2023-05-04T08:18:39Z")

</div>

Sorry! But I solved this problem by the procedure indicated. Because for my case the error is caused because actually the migration is not taking place. This is caused by not adding the app name to the end of the command. Hi

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 4, 2023, 11:01am UTC](https://forum.djangoproject.com/t/postgres-relation-does-not-exist/10695/16 "2023-05-04T11:01:01Z")

</div>

@lordihm I’m sure that’s true - however, the situation that you encountered is not related to the issue being addressed by _this_ thread. (That is why you’ll see that it is recommended that each person open up a new topic for problems they are looking for assistance with.)
