Issue with \d command not working in PostgreSQL lesson

Hi there,
I’m currently working through the “Learn Relational Databases by Building a Database of Video Game Characters” section on freeCodeCamp.

The instructions said:

“You can view more details about a table by adding the table name after the display command like this: \d table_name. View more details about your second_table.”

But when I run \d second_table, it doesn’t seem to work, it’s not being accepted, and nothing is displayed. :thinking: Also, in a previous step, I was asked to display the tables using \d, but it didn’t show anything either.

Here are the screenshots for reference:


Any idea why this might be happening? Thanks in advance for your help!

IIRC, you need to end your statements with a semi-colon. When you created your table, it looks like you didn’t add any columns to it. Did you try a list command (\l) to see what’s there? I mean, you don’t have to run just the commands to pass the test. You can look around to see what’s going on.

does the semicolon ; only apply to specific commands like CREATE DATABASE, or is it also required for meta-commands like \d or \l? I did try using \l and also checked the hints, but they weren’t very helpful. I also tried logging in again using the command, but still no. Here’s what I’m seeing:
image
image

A semi-colon should be used after every command. I’ve never seen a hint prompting to log in again. How far into this one are you? Have you tried doing a reset?

Hmm, this happened before, so I reset the lesson. Now I’m stuck on it again, (started it yesterday and continuing today after the reset.)

I feel your frustration. When I started doing the database projects, I had more trouble with the interface than the code. Seems quirky. Anyway, hang in there, and good luck!

1 Like

in the screenshot you posted the start of the line changed from second_database=> to second_database->, that means that there is an incomplete command, you need to finish your commands. In this case the psql line was left unclosed (even if it’s not syntax accepted inside psql, it still expect to be closed with a ;.

You could find that the start of the line changes to a different character, that means you have something else unclosed, like if it was second_database'> it indicates an unclosed string

1 Like