[SR-Users] Kamctl and Postgresql
Klaus Darilion
klaus.mailinglists at pernau.at
Fri Jul 29 08:25:48 CEST 2011
Hi!
The psql syntax is:
psql [ option... ] [ dbname
[ username ] ]
Thus, not specifying "-d" should work too. Maybe the problem is the -c
after dbname. Anyway, adding -d should be fine too:
-d dbname
--dbname dbname
Specifies the name of the database to connect to. This is
equivalent to specifying dbname as the first non-option argument on the
command line.
regards
Klaus
Am 28.07.2011 05:24, schrieb Nathaniel L Keeling:
> I was using kamctl on Solaris to add a table entry into a postgresql
> database table and received this error:
>
> # ./kamctl domain showdb
> psql: warning: extra command-line argument "-c" ignored
> psql: warning: extra command-line argument "select * FROM domain ; "
> ignored
>
> After some research, I found in kamctl.pgsql the functions:
>
> # input: sql query, optional pgsql command-line params
> pgsql_query() {
> # if password not yet queried, query it now
> prompt_pw "PgSQL password for user '$DBRWUSER@$DBHOST'"
> mecho "pgsql_query: $PGSQL $2 -A -q -t -P fieldsep=' ' -h
> $DBHOST -U $DBRWUSER $DBNAME -c '$1'"
> PGPASSWORD="$DBRWPW" $PGSQL $2 \
> -A -q -t \
> -P fieldsep=" " \
> -h $DBHOST \
> -U $DBRWUSER \
> $DBNAME \
> -c "$1"
> }
>
> # input: sql query, optional pgsql command-line params
> pgsql_ro_query() {
> mdbg "pgsql_ro_query: $PGSQL $2 -h $DBHOST -U $DBROUSER $DBNAME
> -c '$1'"
> PGPASSWORD="$DBROPW" $PGSQL $2 \
> -h $DBHOST \
> -U $DBROUSER \
> $DBNAME \
> -c "$1"
> }
>
>
> I noticed that the database name parameter ($DBNAME) did not have a
> flag. When I added "-d" flag, kamctl worked.
>
> # input: sql query, optional pgsql command-line params
> pgsql_query() {
> # if password not yet queried, query it now
> prompt_pw "PgSQL password for user '$DBRWUSER@$DBHOST'"
> mecho "pgsql_query: $PGSQL $2 -A -q -t -P fieldsep=' ' -h
> $DBHOST -U $DBRWUSER $DBNAME -c '$1'"
> PGPASSWORD="$DBRWPW" $PGSQL $2 \
> -A -q -t \
> -P fieldsep=" " \
> -h $DBHOST \
> -U $DBRWUSER \
> -d $DBNAME \
> -c "$1"
> }
>
> # input: sql query, optional pgsql command-line params
> pgsql_ro_query() {
> mdbg "pgsql_ro_query: $PGSQL $2 -h $DBHOST -U $DBROUSER $DBNAME
> -c '$1'"
> PGPASSWORD="$DBROPW" $PGSQL $2 \
> -h $DBHOST \
> -U $DBROUSER \
> -d $DBNAME \
> -c "$1"
> }
>
> Was this the correct fix or am I missing something else.
>
> Thanks
>
> Nathaniel
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
More information about the sr-users
mailing list