Build a Database of Video Game Characters - Build a Database of Video Game Characters

Tell us what’s happening:

Stuck on this project here for many hours now, just trying to simply make it work.

Have tried it on Codespaces (Firefox, Brave, Chrome) and by installing a local setup (Linux (works) and Windows (not working)). Everywhere it ends when creating the first table in second database - not matter what!! Resetting it doesn’t help either. Maybe you’ve got an idea.

After the first “\l” command further lists or data (\d) is not being displayed - anywhere!

I have done the previous tutorial without any issues on Codespaces. However, I am running out of options being able to continue learning on this section! Please help!

I might be a bit slow answering to your input as I am busy with other things right now…

Your code so far

camper: /project$ psql --username=freecodecamp --dbname=postgres
Border style is 2.
Title is " ".
Pager usage is off.
psql (12.22 (Ubuntu 12.22-0ubuntu0.20.04.4))
Type "help" for help.

postgres=> \l
                               List of databases
+-----------+----------+----------+---------+---------+-----------------------+
|   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges   |
+-----------+----------+----------+---------+---------+-----------------------+
| postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 |                       |
| template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +|
|           |          |          |         |         | postgres=CTc/postgres |
| template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +|
|           |          |          |         |         | postgres=CTc/postgres |
+-----------+----------+----------+---------+---------+-----------------------+
(3 rows)

postgres=> CREATE DATABASE first_database;
postgres=> \l
postgres=> CREATE DATABASE second_database;
postgres=> \l
postgres=> \c second_database;
You are now connected to database "second_database" as user "freecodecamp".
second_database=> \d
Did not find any relations.
second_database=> CREATE TABLE first_table();
FATAL:  terminating connection due to administrator command
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
second_database=> \d
second_database=> CREATE TABLE first_table();
second_database=> \d
second_database=> \l

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:143.0) Gecko/20100101 Firefox/143.0

Challenge Information:

Build a Database of Video Game Characters - Build a Database of Video Game Characters

Do you use an en_us keyboard? Just need to confirm that as some keyboards will write letters in a different encoding that maybe psql doesn’t recognize

It is an en_us keyboard (qwerty) with another language set, currently. Do you think I should try switching to en?

UPDATE: It seems to be working now on chrome with “en” keyboard. Thanks, you’re a genius. I would have to check more thoroughly whether this works for the local setup as well (I ran there into another problem after re-continuing the session).

However, at times, mostly after displaying details, the beginning of the command line does not show (second_database=>), both, with and without being able to type (seldomly).

In the first case, I can just continue without the beginning of the command line (most common).
In the second case when using the “arrow keys + Enter” any non-deleted part of a previous command will show, but it will work.

At times the beginning of the command line is back.

Any idea on this?

Previously, I also had to reset it, but after opening a new terminal window, logging in to psql, opening the second database, etc. I was able to proceed. Hope this will be the same when continuing the next day. Thanks again!

second_database=> \d second_table;
                Table "public.second_table"
+--------------+---------+-----------+----------+---------+
|    Column    |  Type   | Collation | Nullable | Default |
+--------------+---------+-----------+----------+---------+
| first_column | integer |           |          |         |
| id           | integer |           |          |         |
| age          | integer |           |          |         |
+--------------+---------+-----------+----------+---------+

second_database=> ALTER TABLE second_table DROP COLUMN age;
second_database=> ALTER TABLE
ALTER TABLE second\d second_table;
                Table "public.second_table"
+--------------+---------+-----------+----------+---------+
|    Column    |  Type   | Collation | Nullable | Default |
+--------------+---------+-----------+----------+---------+
| first_column | integer |           |          |         |
| id           | integer |           |          |         |
+--------------+---------+-----------+----------+---------+

second_database=> ALTER TABLE second_table DROP COLUMN first_column;
second_database=> ALTER TABLE
ALTER TABLE second_table ADD COLUMN name VARCHAR(30);
second_database=> ALTER TABLE
ALTER TABLE second\d second_table;
                    Table "public.second_table"
+--------+-----------------------+-----------+----------+---------+
| Column |         Type          | Collation | Nullable | Default |
+--------+-----------------------+-----------+----------+---------+
| id     | integer               |           |          |         |
| name   | character varying(30) |           |          |         |
+--------+-----------------------+-----------+----------+---------+

second_database=>

This is good news!

I suggest being careful to end sql commands with a semi-colon. If you forget it, and press enter, you can still type it on the next line.

Also if the result of the command is long you can press space bar until the prompt is returned back to you. (or enter)

-> this shape means you haven’t ended the previous command with a semicolon yet

Quick question: can you tell me how you switched your language setting? Just in case someone else hits this in future and doesn’t know how to do it.

Note: When continuing after a beak, in my case, I had to go to the github .com/codespaces site, clicking on the name which restarts the space. A reset might also help in some cases. Then entering >CodeRoad: Start again, open a new terminal and logging back in with psql --username=freecodecamp --dbname=postgres, including the relevant steps done previously to get to the point where I left off, i.e. opening second-database, etc.

I am on linux debian, so when I first set it up, I did it in the Control Center > Keyboard and selected there the relevant languages for (105 PC Keyboards). Then I added on the panel a shortcut showing the languages. That’s where I actually made the switch to English(US) by clicking on it, toggling through the predefined languages.

Another option is the $setxkbmap command. Running $setxkbmap -query to see the layouts present. Then check $man xkeyboard-config for available options. Finally, change it with $setxkbmap <‘layout name’>, so i.e. $setxkbmap ‘us’ worked for me or even specify the variant with $setxkbmap <‘layout name(variant)’> as listed under xkeyboard-config.

thank you for sharing that. Would you also share what setting did you have prior that did not work? Just for my info. Thank you.