Home > OS >  I tried updating django_site row to change the name but I have gotten ERROR: column "alt native
I tried updating django_site row to change the name but I have gotten ERROR: column "alt native

Time:02-26

I tried updating django_site to change the name (and later domain) to something more appropriate so that i could use these strings for email sending operations.

I understand it is based on this: https://docs.djangoproject.com/en/4.0/ref/contrib/sites/ but I do not know what they are really talking about.

Any help much appreciated.

What I tried:

postgres=# update django_site set django_site.name = "alt native";  
ERROR:  column "alt native" does not exist  
LINE 1: update django_site set django_site.name = "alt native";  
                                                  ^  
postgres=# select * from django_site

 id |   domain    |    name       
---- ------------- -------------  
  1 | example.com | example.com
(1 row)    

CodePudding user response:

In PostgreSQL double quotes (") are used to denoted delimited identifiers, not string literals. Single quotes (') are used for string literals, so you update with:

UPDATE django_site SET name = 'alt native' WHERE id=1;

You probably should also add a WHERE … clause to prevent updating all records.

You should also use name as column, not django_site.name.

  • Related