Salon database. Relation services does not exist error in the terminal

Hello.

I’ve built the sql postgres database, have used chmod to give my script executable permissions and the course reads everything. But it won’t read this simple prompt. Please lmk what I’m missing here.

When I run my script in the terminal it keeps giving me this error.

salon db relation error

#! /bin/bash

PSQL="psql -X --username=freecodecamp --dbname=postgres --tuples-only -c"

echo "~~~~~ MY SALON ~~~~~"
echo -e "\nWelcome to My Salon, how can I help you?"

MAIN_MENU() {

  if [[ $1 ]]
  then 
    echo -e "\n$1"
  fi

# list your services
AVAILABLE_SERVICES=$($PSQL "SELECT * FROM services")
echo "$AVAILABLE_SERVICES" | while read SERVICE_ID BAR SERVICE_NAME
do
  echo "$SERVICE_ID) $SERVICE_NAME"
done  

# get service_id

 # get the name of the service

 # if it doesn't exist

 # send to the main menu

 # ask for phone number

 # get the customer's name

 # if not found

 # ask for name

 # insert new customer

 # ask for the time of appointment

  # get the customer ID
}



MAIN_MENU

That error means that your query can’t find a services table.
Your PSQL variable should connect to your salon database, not postgres.

1 Like

Clearly, I’m (not) very smart. Ty!