![]() ![]() perform SQL COPY with data stream to the client host \ef edit function definition with external editor \e edit the query buffer (or file) with external editor \h help on syntax of SQL commands, * for all commands ![]() \g or execute query (and send results to file or |pipe) \copyright show PostgreSQL usage and distribution terms Accessing help from within the psql prompt requires you to type "\?" i.e., a backslash followed by a question ~]$ psql.Syntaxes are terminated for SQL statements with a semicolon " " similar to that in hive. NOTE We can familiarize ourselves with the utilities and syntaxes later on since the sandbox is meant to tryout and break stuff. We can also execute commands from CLI without going into the psql shell and execute commands from the ~]$ psql -h 172.16.105.137 -p 10432 -d mydb -c "select * from mytable limit 5".Here is how we would need to connect if these variables are not set ~]$ psql -h 172.16.105.137 -p 10432 -d mydemo NOTE: Having these variables configured is a matter of convenience, else you would end up typing these variables. We can ensure that we have all these variables ~]$ env | egrep 'PGHOST|PGPORT|PGDATABASE' Some of the key environment variables required to connect are PGPORT (-p), PGHOST(-h), PGDATABASE(-d)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |