Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid SQL executed in section 18.5 #337

Open
mathemaat opened this issue Aug 8, 2020 · 4 comments
Open

invalid SQL executed in section 18.5 #337

mathemaat opened this issue Aug 8, 2020 · 4 comments

Comments

@mathemaat
Copy link

Location within the Book

  • Book build date: 2020-07-28
  • Book format: PDF
  • Section: 18.5
  • Operating system: Linux (Manjaro)

Description

I've followed all instructions to the book and left all cookiecutter settings at the default. Unfortunately the SQL I have to execute in section 18.5 is invalid.

(dcc-cheese) [mschwartz@marc-pc everycheese]$ python manage.py sqlcreate | sudo -u postgres psql -U postgres
[sudo] password for mschwartz: 
could not change directory to "/home/mschwartz/Documents/programming/everycheese": Permission denied
ERROR:  syntax error at or near "WITH"
LINE 1: CREATE USER  WITH ENCRYPTED PASSWORD '' CREATEDB;
                     ^
ERROR:  zero-length delimited identifier at or near """"
LINE 1: CREATE DATABASE everycheese WITH ENCODING 'UTF-8' OWNER "";
                                                                ^
ERROR:  syntax error at or near ";"
LINE 1: GRANT ALL PRIVILEGES ON DATABASE everycheese TO ;
                                                        ^
(dcc-cheese) [mschwartz@marc-pc everycheese]$ python manage.py sqlcreate
CREATE USER  WITH ENCRYPTED PASSWORD '' CREATEDB;
CREATE DATABASE everycheese WITH ENCODING 'UTF-8' OWNER "";
GRANT ALL PRIVILEGES ON DATABASE everycheese TO ;

Possible Solutions

No idea yet. I will retrace my steps to figure out where it goes wrong.

Your full name

Marc Schwartz

@mathemaat
Copy link
Author

So I retraced my steps from the start, but the end result was the same. I've managed to work around it though, so I can continue with chapter 19 now.

@hlsautter
Copy link

I have the same issue on macOS. How did you work around it?

(everycheese) hsautter@MacBook everycheese % python manage.py sqlcreate | psql
ERROR: syntax error at or near "WITH"
LINE 1: CREATE USER WITH ENCRYPTED PASSWORD '' CREATEDB;
^
ERROR: zero-length delimited identifier at or near """"
LINE 1: CREATE DATABASE everycheese WITH ENCODING 'UTF-8' OWNER "";
^
ERROR: syntax error at or near ";"
LINE 1: GRANT ALL PRIVILEGES ON DATABASE everycheese TO ;
^

@luzfcb
Copy link
Contributor

luzfcb commented Aug 22, 2020

@mathemaat @hlsautter Please, test #320 (comment)

@hlsautter
Copy link

I got past the issue with the createdb command

(everycheese) hsautter@MacBook everycheese % createdb everycheese
(everycheese) hsautter@MacBook everycheese % python manage.py migrate
Operations to perform:
Apply all migrations: account, admin, auth, contenttypes, sessions, sites, socialaccount, users
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying users.0001_initial... OK
Applying account.0001_initial... OK
Applying account.0002_email_max_length... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying sessions.0001_initial... OK
Applying sites.0001_initial... OK
Applying sites.0002_alter_domain_unique... OK
Applying sites.0003_set_site_domain_and_name... OK
Applying socialaccount.0001_initial... OK
Applying socialaccount.0002_token_max_lengths... OK
Applying socialaccount.0003_extra_data_default_dict... OK
(everycheese) hsautter@MacBook everycheese % python manage.py runserver
Watching for file changes with StatReloader
INFO 2020-08-22 19:00:16,362 autoreload 10736 4452777408 Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
August 22, 2020 - 19:00:16
Django version 3.0.9, using settings 'config.settings.local'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants