Periodic Table Database - Build a Periodic Table Database

I’m almost finished on this exercise but I can’t pass the tests :

* If you run `./element.sh 1`, `./element.sh H`, or `./element.sh Hydrogen`, it should output only `The
 element with atomic number 1 is Hydrogen (H). It's a nonmetal, with a 
mass of 1.008 amu. Hydrogen has a melting point of -259.1 celsius and a 
boiling point of -252.9 celsius.`

* If you run `./element.sh` script with another element as input, you should get the same output but with information associated with the given element.

despite my output being exactly as requested.

Here is my code

#! /bin/bash
PSQL="psql -X --username=freecodecamp --dbname=periodic_table --tuples-only -c"
ARG1=$1
EXIT(){
  exit 0
}
CHECK_EXIST(){
  local query_result=$($PSQL "SELECT 1 FROM properties FULL JOIN elements USING (atomic_number) FULL JOIN types USING (type_id) WHERE name = '$1' LIMIT 1" )
  if [[ -z "$query_result" ]]; then
    echo "I could not find that element in the database."
    EXIT
  else
    :
  fi
}
CHECK_EXIST1(){
  local query_result1=$($PSQL "SELECT 1 FROM properties FULL JOIN elements USING (atomic_number) FULL JOIN types USING (type_id) WHERE atomic_number = '$1' LIMIT 1" )
  if [[ -z "$query_result1" ]]; then
    echo "I could not find that element in the database."
    EXIT
  else
    :
  fi
}
CHECK_EXIST2(){
  local query_result2=$($PSQL "SELECT 1 FROM properties FULL JOIN elements USING (atomic_number) FULL JOIN types USING (type_id) WHERE symbol = '$1' LIMIT 1" )
  if [[ -z "$query_result2" ]]; then
    echo "I could not find that element in the database."
    EXIT
  else
    :
  fi
}

MAIN_FUNCTION(){
  ## get all information
  #COMPLETE_DATABASE_QUERY=$($PSQL "SELECT * FROM properties FULL JOIN elements USING (atomic_number) FULL JOIN types USING (type_id) ORDER BY atomic_number")
  if [[ "$ARG1" ]]; then
    
    if [[ $ARG1 =~ ^[0-9]+$ ]]; then
      CHECK_EXIST1 "$ARG1"
      echo $($PSQL "SELECT * FROM properties FULL JOIN elements USING (atomic_number) FULL JOIN types USING (type_id) WHERE atomic_number = '$ARG1' ORDER BY atomic_number")| while read TYPE_ID BAR ATOMIC_NUMBER BAR TYPE BAR ATOMIC_MASS BAR MELTING_POINT_CELSIUS BAR BOILING_POINT_CELSIUS BAR SYMBOL BAR NAME BAR OSEF
      do
        echo "The element with atomic number $ATOMIC_NUMBER is $NAME ($SYMBOL). It's a $TYPE, with a mass of $ATOMIC_MASS amu. $NAME has a melting point of $MELTING_POINT_CELSIUS celsius and a boiling point of $BOILING_POINT_CELSIUS celsius."
      done

    elif [[ $ARG1 =~ ^[a-zA-Z]{3,}$ ]]; then
      CHECK_EXIST "$ARG1"
      echo $($PSQL "SELECT * FROM properties FULL JOIN elements USING (atomic_number) FULL JOIN types USING (type_id) WHERE name = '$ARG1' ORDER BY atomic_number")| while read TYPE_ID BAR ATOMIC_NUMBER BAR TYPE BAR ATOMIC_MASS BAR MELTING_POINT_CELSIUS BAR BOILING_POINT_CELSIUS BAR SYMBOL BAR NAME BAR OSEF
      do
        echo "The element with atomic number $ATOMIC_NUMBER is $NAME ($SYMBOL). It's a $TYPE, with a mass of $ATOMIC_MASS amu. $NAME has a melting point of $MELTING_POINT_CELSIUS celsius and a boiling point of $BOILING_POINT_CELSIUS celsius."
      done

    elif [[ $ARG1 =~ ^[A-Za-z]{1,2}$ ]]; then
      CHECK_EXIST2 "$ARG1"
      echo $($PSQL "SELECT * FROM properties FULL JOIN elements USING (atomic_number) FULL JOIN types USING (type_id) WHERE symbol = '$ARG1' ORDER BY atomic_number")| while read TYPE_ID BAR ATOMIC_NUMBER BAR TYPE BAR ATOMIC_MASS BAR MELTING_POINT_CELSIUS BAR BOILING_POINT_CELSIUS BAR SYMBOL BAR NAME BAR OSEF
      do
        echo "The element with atomic number $ATOMIC_NUMBER is $NAME ($SYMBOL). It's a $TYPE, with a mass of $ATOMIC_MASS amu. $NAME has a melting point of $MELTING_POINT_CELSIUS celsius and a boiling point of $BOILING_POINT_CELSIUS celsius."
      done

    else
      #MAIN_FUNCTION "Please provide a valid argument"
      EXIT
    fi

  else
    echo "Please provide an element as an argument."
    EXIT
  fi
}

MAIN_FUNCTION

This is my output:

codeally@c0beb1b88079:~/project/periodic_table$ ./element.sh 1
The element with atomic number 1 is nonmetal (Hydrogen). It's a 1.008, with a mass of -259.1 amu. nonmetal has a melting point of -252.9 celsius and a boiling point of H celsius.
codeally@c0beb1b88079:~/project/periodic_table$ ./element.sh H
The element with atomic number 1 is nonmetal (Hydrogen). It's a 1.008, with a mass of -259.1 amu. nonmetal has a melting point of -252.9 celsius and a boiling point of H celsius.
codeally@c0beb1b88079:~/project/periodic_table$ ./element.sh Hydrogen
The element with atomic number 1 is nonmetal (Hydrogen). It's a 1.008, with a mass of -259.1 amu. nonmetal has a melting point of -252.9 celsius and a boiling point of H celsius.

My bad, it was the order of elements in the read that was messed up. It did not produce the expected output I noticed it while editing this topic.