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