Mission 114: Using PostgreSQL - Can't figure out what's wrong with my code

Hi there!

Screen Link:

My Code:

conn = psycopg2.connect("dbname=dq user=dq")
conn.autocommit = True
cur = conn.cursor()
cur.execute("CREATE DATABASE income OWNER dq;")

What I expected to happen: to run my code without any problem

What actually happened:

ProgrammingErrorTraceback (most recent call last)
<ipython-input-1-d65c4d9fd011> in <module>()
      2 conn.autocommit = True
      3 cur = conn.cursor()
----> 4 cur.execute("CREATE DATABASE income OWNER dq;")
      5 conn.close()

ProgrammingError: database "income" already exists

The same issue has been kept coming out through out the whole course.
When I enter my code and run, at first, it seems to be working perfectly and doesn’t yield any error message.
However, when I try to submit my code, the output window suddenly starts to show an error like the above and the server won’t accept my code as a right one.
What is strange is that, when I wait for a few minutes and hit the “Submit Answer” button again, it works yet still the output window pops up with the same error message.
My internet connection is okay since I’ve checked it several times and my code is exactly the same as the answer code. I really can’t figure out what is wrong.


hey @idenk9725

this post should help. I have tried the solution. it works for me. let us know in case otherwise.

1 Like

Hi @Rucha

thanks to your reply, I could manage the issue! Plus, now the whole code editor and answer checking system seem to be working fine.