Skip to content
Advertisement

Double quotes problems with Postgres

I am using Django with postgres. Here’s the snippet of my code which I am using to create tables in the db.

My question is:

  1. why is the user table getting renamed as “user” (with quotes)
  2. why is the role_id getting named as role_id_id where as I have clearly mentioned role_id to be my column name? enter image description here

Advertisement

Answer

After reading few answers on Stackoverflow, I think the reason why instead of user (without quotes) a “user” table was getting created is because user is a reserved keyword in postgres and cannot be used for the table name. Coming to the second question about the _id part:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement