+ if (strcmp(cmd, "a") == 0)
+ status = exec_command_a(scan_state, active_branch);
+ else if (strcmp(cmd, "C") == 0)
+ status = exec_command_C(scan_state, active_branch);
+ else if (strcmp(cmd, "c") == 0 || strcmp(cmd, "connect") == 0)
+ status = exec_command_connect(scan_state, active_branch);
+ else if (strcmp(cmd, "cd") == 0)
+ status = exec_command_cd(scan_state, active_branch, cmd);
+ else if (strcmp(cmd, "conninfo") == 0)
+ status = exec_command_conninfo(scan_state, active_branch);
+ else if (pg_strcasecmp(cmd, "copy") == 0)
+ status = exec_command_copy(scan_state, active_branch);
+ else if (strcmp(cmd, "copyright") == 0)
+ status = exec_command_copyright(scan_state, active_branch);
+ else if (strcmp(cmd, "crosstabview") == 0)
+ status = exec_command_crosstabview(scan_state, active_branch);
+ else if (cmd[0] == 'd')
+ status = exec_command_d(scan_state, active_branch, cmd);
+ else if (strcmp(cmd, "e") == 0 || strcmp(cmd, "edit") == 0)
+ status = exec_command_edit(scan_state, active_branch,
+ query_buf, previous_buf);
+ else if (strcmp(cmd, "ef") == 0)
+ status = exec_command_ef_ev(scan_state, active_branch, query_buf, true);
+ else if (strcmp(cmd, "ev") == 0)
+ status = exec_command_ef_ev(scan_state, active_branch, query_buf, false);
+ else if (strcmp(cmd, "echo") == 0 || strcmp(cmd, "qecho") == 0)
+ status = exec_command_echo(scan_state, active_branch, cmd);
+ else if (strcmp(cmd, "elif") == 0)
+ status = exec_command_elif(scan_state, cstack, query_buf);
+ else if (strcmp(cmd, "else") == 0)
+ status = exec_command_else(scan_state, cstack, query_buf);
+ else if (strcmp(cmd, "endif") == 0)
+ status = exec_command_endif(scan_state, cstack, query_buf);
+ else if (strcmp(cmd, "encoding") == 0)
+ status = exec_command_encoding(scan_state, active_branch);
+ else if (strcmp(cmd, "errverbose") == 0)
+ status = exec_command_errverbose(scan_state, active_branch);
+ else if (strcmp(cmd, "f") == 0)
+ status = exec_command_f(scan_state, active_branch);
+ else if (strcmp(cmd, "g") == 0 || strcmp(cmd, "gx") == 0)
+ status = exec_command_g(scan_state, active_branch, cmd);
+ else if (strcmp(cmd, "gdesc") == 0)
+ status = exec_command_gdesc(scan_state, active_branch);
+ else if (strcmp(cmd, "gexec") == 0)
+ status = exec_command_gexec(scan_state, active_branch);
+ else if (strcmp(cmd, "gset") == 0)
+ status = exec_command_gset(scan_state, active_branch);
+ else if (strcmp(cmd, "h") == 0 || strcmp(cmd, "help") == 0)
+ status = exec_command_help(scan_state, active_branch);
+ else if (strcmp(cmd, "H") == 0 || strcmp(cmd, "html") == 0)
+ status = exec_command_html(scan_state, active_branch);
+ else if (strcmp(cmd, "i") == 0 || strcmp(cmd, "include") == 0 ||
+ strcmp(cmd, "ir") == 0 || strcmp(cmd, "include_relative") == 0)
+ status = exec_command_include(scan_state, active_branch, cmd);
+ else if (strcmp(cmd, "if") == 0)
+ status = exec_command_if(scan_state, cstack, query_buf);
+ else if (strcmp(cmd, "l") == 0 || strcmp(cmd, "list") == 0 ||
+ strcmp(cmd, "l+") == 0 || strcmp(cmd, "list+") == 0)
+ status = exec_command_list(scan_state, active_branch, cmd);
+ else if (strncmp(cmd, "lo_", 3) == 0)
+ status = exec_command_lo(scan_state, active_branch, cmd);
+ else if (strcmp(cmd, "o") == 0 || strcmp(cmd, "out") == 0)
+ status = exec_command_out(scan_state, active_branch);
+ else if (strcmp(cmd, "p") == 0 || strcmp(cmd, "print") == 0)
+ status = exec_command_print(scan_state, active_branch,
+ query_buf, previous_buf);
+ else if (strcmp(cmd, "password") == 0)
+ status = exec_command_password(scan_state, active_branch);
+ else if (strcmp(cmd, "prompt") == 0)
+ status = exec_command_prompt(scan_state, active_branch, cmd);
+ else if (strcmp(cmd, "pset") == 0)
+ status = exec_command_pset(scan_state, active_branch);
+ else if (strcmp(cmd, "q") == 0 || strcmp(cmd, "quit") == 0)
+ status = exec_command_quit(scan_state, active_branch);
+ else if (strcmp(cmd, "r") == 0 || strcmp(cmd, "reset") == 0)
+ status = exec_command_reset(scan_state, active_branch, query_buf);
+ else if (strcmp(cmd, "s") == 0)
+ status = exec_command_s(scan_state, active_branch);
+ else if (strcmp(cmd, "set") == 0)
+ status = exec_command_set(scan_state, active_branch);
+ else if (strcmp(cmd, "setenv") == 0)
+ status = exec_command_setenv(scan_state, active_branch, cmd);
+ else if (strcmp(cmd, "sf") == 0 || strcmp(cmd, "sf+") == 0)
+ status = exec_command_sf_sv(scan_state, active_branch, cmd, true);
+ else if (strcmp(cmd, "sv") == 0 || strcmp(cmd, "sv+") == 0)
+ status = exec_command_sf_sv(scan_state, active_branch, cmd, false);
+ else if (strcmp(cmd, "t") == 0)
+ status = exec_command_t(scan_state, active_branch);
+ else if (strcmp(cmd, "T") == 0)
+ status = exec_command_T(scan_state, active_branch);
+ else if (strcmp(cmd, "timing") == 0)
+ status = exec_command_timing(scan_state, active_branch);
+ else if (strcmp(cmd, "unset") == 0)
+ status = exec_command_unset(scan_state, active_branch, cmd);
+ else if (strcmp(cmd, "w") == 0 || strcmp(cmd, "write") == 0)
+ status = exec_command_write(scan_state, active_branch, cmd,
+ query_buf, previous_buf);
+ else if (strcmp(cmd, "watch") == 0)
+ status = exec_command_watch(scan_state, active_branch,
+ query_buf, previous_buf);
+ else if (strcmp(cmd, "x") == 0)
+ status = exec_command_x(scan_state, active_branch);
+ else if (strcmp(cmd, "z") == 0)
+ status = exec_command_z(scan_state, active_branch);
+ else if (strcmp(cmd, "!") == 0)
+ status = exec_command_shell_escape(scan_state, active_branch);
+ else if (strcmp(cmd, "?") == 0)
+ status = exec_command_slash_command_help(scan_state, active_branch);
+ else
+ status = PSQL_CMD_UNKNOWN;