psql: why not pset PROMPT[0-2] ? - Mailing list pgsql-hackers

From Michal Maru¹ka
Subject psql: why not pset PROMPT[0-2] ?
Date
Msg-id 14976.28025.353752.394761@linux3.maruska.tin.it
Whole thread Raw
Responses Re: psql: why not pset PROMPT[0-2] ?  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
(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);     }



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....
Next
From: Peter Eisentraut
Date:
Subject: Re: psql: why not pset PROMPT[0-2] ?