Understanding psql flags

PSQL=“psql -X --username=freecodecamp --dbname=students --no-align --tuples-only -c”

if any one give me a brief explanation about the flags:- -X,–no-align ?
i have seen the documentation of postgres on this flags but can not understand.

The X flag ignores any settings you may have in your environment that were placed in the psqlrc file. (This is probably done to make sure the tests have consistent results for every person taking the course)

The no-align will prevent the results from having extra spaces to make them look neat and aligned (which would make you work harder in the script to trim them)

3 Likes

Is this code correct if I use my own username?

PSQL="psql -X --username=postgres --dbname=students --no-align --tuples-only -c"

sorry for the late reply, well that depends on which course that you are working, if you are working on the students database i think you should name it --username=freecodecamp since i think it is given in the instruction, let me know if you have any questions.

I’m using my own visual studio code to run the student database 1 bash script.

When I finally configured all the connection network in the visual studio code to ‘trust’, I can login the psql from bash terminal successfully.

However, the visual studio code cannot run the codes properly after I typed in ./insert_data.sh in the bash terminal

The problem is bash command not found. I already installed the git bash but still the code doesn’t work properly.

The response is keep asking for username password after the correct password is typed in the terminal.

And then the code load one line of data to the postgres database tables right after I keyed in the correct password.

After two lines of passwords request with correct password entered in the terminl, another line of data is loaded to one of the tables in the student database.

Not sure why. If I can’t use th visual studio code to create bash script with postgres database, then what other program can I use?

As I remember you can run the relational database locally, but you cannot earn your certification running these locally. please read this to run locally.also this to use browser version.

I am trying to create a copy so that I can experiment how to use it for another course which is building celestial bodies.

It defeats the purpose of passing all the courses when in reality I can’t even use any program to create a similar copy for other purposes.