# Questions about django3.05 and postgresql

**URL:** <https://forum.djangoproject.com/t/questions-about-django3-05-and-postgresql/1815>\
**Category:** Using the ORM\
**Created:** [April 5, 2020, 4:23am UTC](https://forum.djangoproject.com/t/questions-about-django3-05-and-postgresql/1815 "2020-04-05T04:23:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shangye2000](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@shangye2000](https://forum.djangoproject.com/u/shangye2000)\
**Post date:** [April 5, 2020, 4:23am UTC](https://forum.djangoproject.com/t/questions-about-django3-05-and-postgresql/1815/1 "2020-04-05T04:23:54Z")

</div>

The database uses postgresql10.12, (WINDOWS7 environment)  
Use django3.05 + python3.7 + psycopg2 2.84 + pycharm to create a project: mysit5\_305, create an application under the project: Article

 ![0001](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/1X/e7267ecfb7496d72af902357e7906203652672cc.jpeg)  
image 1(Because there can only be one picture, this picture contains all the pictures)

image 2

Modify the database section in settings.py as follows:  
DATABASES = {  
‘default’: {  
‘ENGINE’: ‘django.db.backends.postgresql’,  
‘NAME’: ‘mysit’,  
‘HOST’: ‘localhost’,  
‘PROT’: ‘5432’,  
‘USER’: ‘postgres’,  
‘PASSWORD’: ‘abc123’,  
}  
}  
Add the application “Article” in setting.py

Create a database in postgresql: mysit

image 3  
Modify Models.py in the application Article as follows:  
class Article (models.Model):  
t = models.CharField (max\_length = 50)  
c = models.TextField ()

Perform makemigrations and migrate

Article\_article will be generated in postgresql

After we perform a select operation, we find that the table does not exist, but from the visual list we find that the table exists

image 4  
After we register this model in the application’s admin.py and open it in the foreground to add data, we found that it can be added

image 5

image 6 database visual interface  
The added data can also be found in the database visual interface  
But through the statement: select \* from Article\_article; but an error:  
ERROR: relation “article\_article” does not exist

image 7  
Is there something wrong with this Article\_article? Can only be accessed through django?  
Why does django3.05 create a postgresql table only django can read and write, there will be problems through SQL statements? Is this a django3.05 bug for postgresql?  
But I do: select \* from auth\_user; can be queried

image 8  
I also found an interesting situation: I can also create a table with the same name in the database visual interface. It is said that the postgresql table name is not case sensitive, and the table with the same name cannot be created.

image 9

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [April 5, 2020, 10:08am UTC](https://forum.djangoproject.com/t/questions-about-django3-05-and-postgresql/1815/2 "2020-04-05T10:08:54Z")

</div>

I don’t think Django has any bugs here.

I think to select from the table in your database software, you need to quote the table name with double quotes: `SELECT * FROM "Article_article"`, so that PostgreSQL doesn’t convert it to lower case automatically.

I would recommend though that you rename your app to use lowercase characters only in its name. Python modules are best in lowercase because file systems, like databases, have mixed behaviour with case handling. PEP8, the Python style guide, recommends this: [https://www.python.org/dev/peps/pep-0008/](https://www.python.org/dev/peps/pep-0008/) .

---

<div class="post-metadata">

**Author:** ![shangye2000](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@shangye2000](https://forum.djangoproject.com/u/shangye2000)\
**Post date:** [April 5, 2020, 1:06pm UTC](https://forum.djangoproject.com/t/questions-about-django3-05-and-postgresql/1815/3 "2020-04-05T13:06:37Z")

</div>

Hi, thank you for your help, it is indeed the case, I just tested it, and double quotes around the table name can indeed be queried with SELECT.  
I checked the information. PostgreSQL is not case sensitive in SQL statements, but in fact PostgreSQL is case sensitive for table names and column names.  
Thanks again for your help!
