psql -c "select * from a-user-name-that-exist fails

Поиск
Список
Период
Сортировка
От lalebarde
Тема psql -c "select * from a-user-name-that-exist fails
Дата
Msg-id 1285283649755-2852042.post@n5.nabble.com
обсуждение исходный текст
Ответы Re: psql -c "select * from a-user-name-that-exist fails  (Josh Kupershmidt <schmiddy@gmail.com>)
Re: psql -c "select * from a-user-name-that-exist fails  (Josh Kupershmidt <schmiddy@gmail.com>)
Список pgsql-novice
Hi all,

I have just installed PostGreSQL on my Gentoo Linux Desktop for the first
time. Installation is ok. Then, I have started to install an application
that uses PostGreSQL. To test if I am declared as a user in the data base,
it executes the command :

psql -c "select * from laurent

More precisely this bash script :

----------------------------------------------------------------------------------------
function exit_if_no_postgres_user
{
    set +e
    ( psql -q template1 -c "select * from pg_user;" | grep $1 ) \
                >/dev/null 2>&1
    if [ $? -eq 1 ]
    then
    echo ""
    echo "*** Error: No postgresql user '$1'"
    echo ""
    exit 1
#    else
#    echo "Good: Postgresql can be accessed by $1"
    fi
    set -e
}
-----------------------------------------------------------------------------------------
USER=$(whoami) is passed as an argument which is $1
-----------------------------------------------------------------------------------------


laurent being the user's name. The error is triggered, thought laurent was
declared with the command : createuser -d -A laurent. laurent appears in the
pgadmin3 roles list. As far as I have understood the documentation, roles
and users are the same thing.
Besides, I am surprised by the "template". What is it for ?

Any clue why I get this error ?






--
View this message in context:
http://postgresql.1045698.n5.nabble.com/psql-c-select-from-a-user-name-that-exist-fails-tp2852042p2852042.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

В списке pgsql-novice по дате отправления:

Предыдущее
От: Jorge Alberto Fuentes Casillas
Дата:
Сообщение: DB Transfer
Следующее
От: Josh Kupershmidt
Дата:
Сообщение: Re: psql -c "select * from a-user-name-that-exist fails