Thread: psql: why not pset PROMPT[0-2] ?

psql: why not pset PROMPT[0-2] ?

From
"Michal Maru¹ka"
Date:
(In psql:)
I need to modify the 2nd prompt. So i looked at the sources:
I leave the validity test (of the name of the option/param) to SetVariable !!



Here is the patch:

diff -c /internet/cvs/pgsql/src/bin/psql/command.c.~1~ /internet/cvs/pgsql/src/bin/psql/command.c
*** /internet/cvs/pgsql/src/bin/psql/command.c.~1~    Tue Feb  6 22:26:00 2001
--- /internet/cvs/pgsql/src/bin/psql/command.c    Tue Feb  6 22:26:00 2001
***************
*** 1745,1750 ****
--- 1745,1760 ----     }  
+ 
+     /* toggle use of pager */
+     else if (strncmp(param, "PROMPT",6) == 0)
+     {
+       SetVariable(pset.vars, param, value);    /* SetVariable takes care of whether param is actually valid !! */
+     }
+ 
+ 
+ 
+      else     {         psql_error("\\pset: unknown option: %s\n", param);





diff -c /internet/cvs/pgsql/src/bin/psql/tab-complete.c.~2~ /internet/cvs/pgsql/src/bin/psql/tab-complete.c
*** /internet/cvs/pgsql/src/bin/psql/tab-complete.c.~2~    Tue Feb  6 22:24:06 2001
--- /internet/cvs/pgsql/src/bin/psql/tab-complete.c    Tue Feb  6 22:24:06 2001
***************
*** 706,713 ****     else if (strcmp(prev_wd, "\\pset") == 0)     {         char       *my_list[] = {"format",
"border","expanded", "null", "fieldsep",
 
!             "tuples_only", "title", "tableattr", "pager",
!         "recordsep", NULL};          COMPLETE_WITH_LIST(my_list);     }
--- 706,713 ----     else if (strcmp(prev_wd, "\\pset") == 0)     {         char       *my_list[] = {"format",
"border","expanded", "null", "fieldsep",
 
!                      "tuples_only", "title", "tableattr", "pager", 
!                      "PROMPT1","PROMPT2","PROMPT3","recordsep", NULL};          COMPLETE_WITH_LIST(my_list);     }



Re: psql: why not pset PROMPT[0-2] ?

From
Peter Eisentraut
Date:
Because pset sets parameters of the table output.  Prompts have nothing to
do with table output.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/