]> granicus.if.org Git - postgresql/blobdiff - src/bin/psql/prompt.c
Support \if ... \elif ... \else ... \endif in psql scripting.
[postgresql] / src / bin / psql / prompt.c
index f7930c4a83991a8f16a0b5e0a1df9ce4e2574452..e502ff3f6e61292a8726a95959eae56c1d302675 100644 (file)
@@ -66,7 +66,7 @@
  */
 
 char *
-get_prompt(promptStatus_t status)
+get_prompt(promptStatus_t status, ConditionalStack cstack)
 {
 #define MAX_PROMPT_SIZE 256
        static char destination[MAX_PROMPT_SIZE + 1];
@@ -188,7 +188,9 @@ get_prompt(promptStatus_t status)
                                        switch (status)
                                        {
                                                case PROMPT_READY:
-                                                       if (!pset.db)
+                                                       if (cstack != NULL && !conditional_active(cstack))
+                                                               buf[0] = '@';
+                                                       else if (!pset.db)
                                                                buf[0] = '!';
                                                        else if (!pset.singleline)
                                                                buf[0] = '=';