Quoth Kusuma Pabba <kusumap@xxxxxxxxxxxxx>: > /usr/local/pgsql/bin/psql test > test=# > sudo su postgres -c psql template1 > template=# > why is the path different in both cases? Type: $ which psql and $ sudo which psql The answer is the same, yes? $ /usr/local/pgsql/bin/psql test |___________________| | absolute path $ cd /usr/local/pgsql $ bin/psql test |__| | relative path When you provide an absolute path (or a relative path), your shell does not search your $PATH environment variable for the program - it just runs the program in the directory you specified. When you don't provide a path of any sort, your shell looks for the program in the directories specified in your $PATH environment variable. Check the value of your $PATH by typing: $ echo $PATH If there is only one executable file called 'psql' in the directories in your PATH, it makes no difference whether you specify a path, or no path at all. Note that different users may have different directories in their $PATH. Your can alter your $PATH variable (if you need to) in your ~/.profile. > what is the difference between the above two and, 'sudo <command>' is a command for running a single command with superuser privileges, i.e., 'as root'. 'su <user>' (without the -c switch) is a command for 'becoming' <user> until you type 'exit'. 'su <user> -c <command>' is similar to 'sudo' in that the single command <command> is run as <user>. If you type: $ su postgres -c psql template1 you will be asked for a password, and if you haven't setup any user accounts and passwords in postgres you won't know what the password is, and therefore you won't be able to connect. This is why you need to type 'sudo su postgres -c psql template1'. sudo temporarily makes you root, and root is never asked for passwords (root is God in the UNIX world) so you are able to connect as user 'postgres'. > how can i create a user in test or template? > when i give create user it is asking for create role , how should i > create role? Others with a better understanding of users and roles should answer this question. Sebastian -- Emacs' AlsaPlayer - Music Without Jolts Lightweight, full-featured and mindful of your idyllic happiness. http://home.gna.org/eap -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general