PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <ctype.h>
#include <time.h>
#include <pwd.h>
#include <utime.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "catalog/pg_class_d.h"
#include "command.h"
#include "common.h"
#include "common/logging.h"
#include "common/string.h"
#include "copy.h"
#include "describe.h"
#include "fe_utils/cancel.h"
#include "fe_utils/print.h"
#include "fe_utils/string_utils.h"
#include "help.h"
#include "input.h"
#include "large_obj.h"
#include "libpq/pqcomm.h"
#include "mainloop.h"
#include "pqexpbuffer.h"
#include "psqlscanslash.h"
#include "settings.h"
#include "variables.h"
Go to the source code of this file.
Macros | |
#define | DEFAULT_SHELL "/bin/sh" |
Typedefs | |
typedef enum EditableObjectType | EditableObjectType |
Enumerations | |
enum | EditableObjectType { EditableFunction , EditableView } |
Functions | |
static backslashResult | exec_command (const char *cmd, PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf, PQExpBuffer previous_buf) |
static backslashResult | exec_command_a (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_bind (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_bind_named (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_C (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_connect (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_cd (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_close (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_conninfo (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_copy (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_copyright (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_crosstabview (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_d (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static bool | exec_command_dfo (PsqlScanState scan_state, const char *cmd, const char *pattern, bool show_verbose, bool show_system) |
static backslashResult | exec_command_edit (PsqlScanState scan_state, bool active_branch, PQExpBuffer query_buf, PQExpBuffer previous_buf) |
static backslashResult | exec_command_ef_ev (PsqlScanState scan_state, bool active_branch, PQExpBuffer query_buf, bool is_func) |
static backslashResult | exec_command_echo (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_elif (PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf) |
static backslashResult | exec_command_else (PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf) |
static backslashResult | exec_command_endif (PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf) |
static backslashResult | exec_command_encoding (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_errverbose (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_f (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_g (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | process_command_g_options (char *first_option, PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_gdesc (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_getenv (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_gexec (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_gset (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_help (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_html (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_include (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_if (PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf) |
static backslashResult | exec_command_list (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_lo (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_out (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_print (PsqlScanState scan_state, bool active_branch, PQExpBuffer query_buf, PQExpBuffer previous_buf) |
static backslashResult | exec_command_parse (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_password (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_prompt (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_pset (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_quit (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_reset (PsqlScanState scan_state, bool active_branch, PQExpBuffer query_buf) |
static backslashResult | exec_command_s (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_set (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_setenv (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_sf_sv (PsqlScanState scan_state, bool active_branch, const char *cmd, bool is_func) |
static backslashResult | exec_command_t (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_T (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_timing (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_unset (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_write (PsqlScanState scan_state, bool active_branch, const char *cmd, PQExpBuffer query_buf, PQExpBuffer previous_buf) |
static backslashResult | exec_command_watch (PsqlScanState scan_state, bool active_branch, PQExpBuffer query_buf, PQExpBuffer previous_buf) |
static backslashResult | exec_command_x (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_z (PsqlScanState scan_state, bool active_branch, const char *cmd) |
static backslashResult | exec_command_shell_escape (PsqlScanState scan_state, bool active_branch) |
static backslashResult | exec_command_slash_command_help (PsqlScanState scan_state, bool active_branch) |
static char * | read_connect_arg (PsqlScanState scan_state) |
static PQExpBuffer | gather_boolean_expression (PsqlScanState scan_state) |
static bool | is_true_boolean_expression (PsqlScanState scan_state, const char *name) |
static void | ignore_boolean_expression (PsqlScanState scan_state) |
static void | ignore_slash_options (PsqlScanState scan_state) |
static void | ignore_slash_filepipe (PsqlScanState scan_state) |
static void | ignore_slash_whole_line (PsqlScanState scan_state) |
static bool | is_branching_command (const char *cmd) |
static void | save_query_text_state (PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf) |
static void | discard_query_text (PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf) |
static bool | copy_previous_query (PQExpBuffer query_buf, PQExpBuffer previous_buf) |
static bool | do_connect (enum trivalue reuse_previous_specification, char *dbname, char *user, char *host, char *port) |
static void | wait_until_connected (PGconn *conn) |
static bool | do_edit (const char *filename_arg, PQExpBuffer query_buf, int lineno, bool discard_on_quit, bool *edited) |
static bool | do_shell (const char *command) |
static bool | do_watch (PQExpBuffer query_buf, double sleep, int iter, int min_rows) |
static bool | lookup_object_oid (EditableObjectType obj_type, const char *desc, Oid *obj_oid) |
static bool | get_create_object_cmd (EditableObjectType obj_type, Oid oid, PQExpBuffer buf) |
static int | strip_lineno_from_objdesc (char *obj) |
static int | count_lines_in_buf (PQExpBuffer buf) |
static void | print_with_linenumbers (FILE *output, char *lines, bool is_func) |
static void | minimal_error_message (PGresult *res) |
static void | printSSLInfo (void) |
static void | printGSSInfo (void) |
static bool | printPsetInfo (const char *param, printQueryOpt *popt) |
static char * | pset_value_string (const char *param, printQueryOpt *popt) |
backslashResult | HandleSlashCmds (PsqlScanState scan_state, ConditionalStack cstack, PQExpBuffer query_buf, PQExpBuffer previous_buf) |
static char * | prompt_for_password (const char *username, bool *canceled) |
static bool | param_is_newly_set (const char *old_val, const char *new_val) |
void | connection_warnings (bool in_startup) |
void | SyncVariables (void) |
void | UnsyncVariables (void) |
static bool | editFile (const char *fname, int lineno) |
int | process_file (char *filename, bool use_relative_path) |
static const char * | _align2string (enum printFormat in) |
static bool | set_unicode_line_style (const char *value, size_t vallen, unicode_linestyle *linestyle) |
static const char * | _unicode_linestyle2string (int linestyle) |
bool | do_pset (const char *param, const char *value, printQueryOpt *popt, bool quiet) |
printQueryOpt * | savePsetInfo (const printQueryOpt *popt) |
void | restorePsetInfo (printQueryOpt *popt, printQueryOpt *save) |
static const char * | pset_bool_string (bool val) |
static char * | pset_quoted_string (const char *str) |
static bool | echo_hidden_command (const char *query) |
typedef enum EditableObjectType EditableObjectType |
enum EditableObjectType |
|
static |
Definition at line 4479 of file command.c.
References PRINT_ALIGNED, PRINT_ASCIIDOC, PRINT_CSV, PRINT_HTML, PRINT_LATEX, PRINT_LATEX_LONGTABLE, PRINT_NOTHING, PRINT_TROFF_MS, PRINT_UNALIGNED, and PRINT_WRAPPED.
Referenced by printPsetInfo(), and pset_value_string().
|
static |
Definition at line 4535 of file command.c.
References UNICODE_LINESTYLE_DOUBLE, and UNICODE_LINESTYLE_SINGLE.
Referenced by printPsetInfo(), and pset_value_string().
void connection_warnings | ( | bool | in_startup | ) |
Definition at line 3946 of file command.c.
References _, _psqlSettings::db, formatPGVersionNumber(), _psqlSettings::notty, PQparameterStatus(), printf, printGSSInfo(), printSSLInfo(), _psqlSettings::progname, pset, _psqlSettings::quiet, server_version, and _psqlSettings::sversion.
Referenced by CheckConnection(), do_connect(), and main().
|
static |
Definition at line 3351 of file command.c.
References appendPQExpBufferStr(), PQExpBufferData::data, and PQExpBufferData::len.
Referenced by exec_command(), exec_command_edit(), and exec_command_watch().
|
static |
|
static |
Definition at line 3325 of file command.c.
References Assert, conditional_stack_get_paren_depth(), conditional_stack_get_query_len(), PQExpBufferData::data, PQExpBufferData::len, len, and psql_scan_set_paren_depth().
Referenced by exec_command_elif(), exec_command_else(), and exec_command_endif().
|
static |
Definition at line 3420 of file command.c.
References _, Assert, CONNECTION_OK, connection_warnings(), _psqlSettings::cur_cmd_interactive, _psqlSettings::db, dbname, _psqlSettings::dead_conn, errmsg(), _psqlSettings::getPassword, is_unixsock_path(), _PQconninfoOption::keyword, NoticeProcessor(), _psqlSettings::notty, param_is_newly_set(), password, pg_free(), pg_log_error, pg_log_info, pg_malloc(), port, PQconndefaults(), PQconnectionNeedsPassword(), PQconnectStartParams(), PQconninfo(), PQconninfoFree(), PQconninfoParse(), PQdb(), PQerrorMessage(), PQfinish(), PQfreemem(), PQhost(), PQhostaddr(), PQport(), PQsetNoticeProcessor(), PQstatus(), PQuser(), printf, _psqlSettings::progname, prompt_for_password(), pset, _psqlSettings::quiet, recognized_connection_string(), ResetCancelConn(), success, SyncVariables(), TRI_NO, TRI_YES, UnsyncVariables(), user, _PQconninfoOption::val, values, and wait_until_connected().
Referenced by exec_command_connect().
|
static |
Definition at line 4217 of file command.c.
References appendPQExpBufferChar(), appendPQExpBufferStr(), before(), PQExpBufferData::data, editFile(), error(), fd(), PQExpBufferData::len, MAXPGPATH, PG_BINARY_R, pg_log_error, resetPQExpBuffer(), snprintf, stat::st_mtime, stat::st_size, stat, and strerror.
Referenced by exec_command_edit(), and exec_command_ef_ev().
bool do_pset | ( | const char * | param, |
const char * | value, | ||
printQueryOpt * | popt, | ||
bool | quiet | ||
) |
Definition at line 4565 of file command.c.
References Assert, printTableOpt::border, printTableOpt::columns, printTableOpt::csvFieldSep, printTableOpt::default_footer, printTableOpt::expanded, printTableOpt::expanded_header_exact_width, printTableOpt::expanded_header_width_type, printTableOpt::fieldSep, fmt, printTableOpt::format, free, i, lengthof, printTableOpt::line_style, name, printQueryOpt::nullPrint, printTableOpt::numericLocale, printTableOpt::pager, printTableOpt::pager_min_lines, ParseVariableBool(), ParseVariableNum(), pg_asciiformat, pg_asciiformat_old, pg_log_error, pg_strcasecmp(), pg_strdup(), pg_strncasecmp(), pg_utf8format, _psqlSettings::popt, PRINT_ALIGNED, PRINT_ASCIIDOC, PRINT_CSV, PRINT_HTML, PRINT_LATEX, PRINT_LATEX_LONGTABLE, PRINT_TROFF_MS, PRINT_UNALIGNED, PRINT_WRAPPED, PRINT_XHEADER_COLUMN, PRINT_XHEADER_EXACT_WIDTH, PRINT_XHEADER_FULL, PRINT_XHEADER_PAGE, printPsetInfo(), pset, PsqlVarEnumError(), printTableOpt::recordSep, refresh_utf8format(), separator::separator, separator::separator_zero, set_unicode_line_style(), printTableOpt::tableAttr, printQueryOpt::title, printQueryOpt::topt, printTableOpt::tuples_only, printTableOpt::unicode_border_linestyle, printTableOpt::unicode_column_linestyle, printTableOpt::unicode_header_linestyle, and value.
Referenced by exec_command_a(), exec_command_C(), exec_command_f(), exec_command_html(), exec_command_pset(), exec_command_t(), exec_command_T(), exec_command_x(), parse_psql_options(), and process_command_g_options().
|
static |
Definition at line 5314 of file command.c.
References DEFAULT_SHELL, fflush(), free, pg_log_error, psprintf(), and SetShellResultVariables().
Referenced by exec_command_shell_escape().
|
static |
Definition at line 5365 of file command.c.
References _, cancel_pressed, PQExpBufferData::data, disable_sigpipe_trap(), EINTR, fflush(), fprintf, i, ITIMER_REAL, PQExpBufferData::len, Min, printTableOpt::pager, pg_free(), pg_log_error, pg_malloc(), pg_usleep(), _psqlSettings::popt, pset, PSQLexecWatch(), res, restore_sigpipe_trap(), setitimer(), SIGALRM, SIGCHLD, sleep_ms, snprintf, generate_unaccent_rules::stdout, printQueryOpt::title, and printQueryOpt::topt.
Referenced by exec_command_watch().
|
static |
Definition at line 5606 of file command.c.
References _, _psqlSettings::echo_hidden, fflush(), fprintf, _psqlSettings::logfile, printf, pset, PSQL_ECHO_HIDDEN_NOEXEC, PSQL_ECHO_HIDDEN_OFF, and generate_unaccent_rules::stdout.
Referenced by get_create_object_cmd(), and lookup_object_oid().
|
static |
Definition at line 4135 of file command.c.
References Assert, DEFAULT_EDITOR, DEFAULT_EDITOR_LINENUMBER_ARG, fflush(), free, pg_log_error, and psprintf().
Referenced by do_edit().
|
static |
Definition at line 291 of file command.c.
References conditional_active(), copy_previous_query(), _psqlSettings::cur_cmd_interactive, exec_command_a(), exec_command_bind(), exec_command_bind_named(), exec_command_C(), exec_command_cd(), exec_command_close(), exec_command_connect(), exec_command_conninfo(), exec_command_copy(), exec_command_copyright(), exec_command_crosstabview(), exec_command_d(), exec_command_echo(), exec_command_edit(), exec_command_ef_ev(), exec_command_elif(), exec_command_else(), exec_command_encoding(), exec_command_endif(), exec_command_errverbose(), exec_command_f(), exec_command_g(), exec_command_gdesc(), exec_command_getenv(), exec_command_gexec(), exec_command_gset(), exec_command_help(), exec_command_html(), exec_command_if(), exec_command_include(), exec_command_list(), exec_command_lo(), exec_command_out(), exec_command_parse(), exec_command_password(), exec_command_print(), exec_command_prompt(), exec_command_pset(), exec_command_quit(), exec_command_reset(), exec_command_s(), exec_command_set(), exec_command_setenv(), exec_command_sf_sv(), exec_command_shell_escape(), exec_command_slash_command_help(), exec_command_t(), exec_command_T(), exec_command_timing(), exec_command_unset(), exec_command_watch(), exec_command_write(), exec_command_x(), exec_command_z(), is_branching_command(), pg_log_warning, pg_strcasecmp(), pset, PSQL_CMD_SEND, and PSQL_CMD_UNKNOWN.
Referenced by HandleSlashCmds().
|
static |
Definition at line 454 of file command.c.
References do_pset(), printTableOpt::format, _psqlSettings::popt, PRINT_ALIGNED, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, _psqlSettings::quiet, success, and printQueryOpt::topt.
Referenced by exec_command().
|
static |
Definition at line 473 of file command.c.
References _psqlSettings::bind_nparams, _psqlSettings::bind_params, clean_extended_state(), ignore_slash_options(), OT_NORMAL, pg_realloc_array, pset, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), PSQL_SEND_EXTENDED_QUERY_PARAMS, and _psqlSettings::send_mode.
Referenced by exec_command().
|
static |
Definition at line 509 of file command.c.
References _psqlSettings::bind_nparams, _psqlSettings::bind_params, clean_extended_state(), ignore_slash_options(), OT_NORMAL, pg_log_error, pg_realloc_array, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), PSQL_SEND_EXTENDED_QUERY_PREPARED, _psqlSettings::send_mode, and _psqlSettings::stmtName.
Referenced by exec_command().
|
static |
Definition at line 558 of file command.c.
References do_pset(), free, ignore_slash_options(), OT_NORMAL, _psqlSettings::popt, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::quiet, and success.
Referenced by exec_command().
|
static |
Definition at line 644 of file command.c.
References _, free, ignore_slash_options(), OT_NORMAL, pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), strerror, and success.
Referenced by exec_command().
|
static |
Definition at line 708 of file command.c.
References clean_extended_state(), ignore_slash_options(), OT_NORMAL, pg_log_error, pset, PSQL_CMD_ERROR, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), PSQL_SEND_EXTENDED_CLOSE, _psqlSettings::send_mode, and _psqlSettings::stmtName.
Referenced by exec_command().
|
static |
Definition at line 591 of file command.c.
References do_connect(), free, ignore_slash_options(), ParseVariableBool(), PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, read_connect_arg(), success, TRI_DEFAULT, TRI_NO, and TRI_YES.
Referenced by exec_command().
|
static |
Definition at line 741 of file command.c.
References _, _psqlSettings::db, is_unixsock_path(), PQdb(), PQhost(), PQhostaddr(), PQport(), PQuser(), printf, printGSSInfo(), printSSLInfo(), pset, and PSQL_CMD_SKIP_LINE.
Referenced by exec_command().
|
static |
Definition at line 785 of file command.c.
References do_copy(), free, ignore_slash_whole_line(), OT_WHOLE_LINE, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), and success.
Referenced by exec_command().
|
static |
Definition at line 807 of file command.c.
References print_copyright(), and PSQL_CMD_SKIP_LINE.
Referenced by exec_command().
|
static |
Definition at line 819 of file command.c.
References _psqlSettings::crosstab_flag, _psqlSettings::ctv_args, i, ignore_slash_options(), lengthof, OT_NORMAL, pset, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, and psql_scan_slash_option().
Referenced by exec_command().
|
static |
Definition at line 843 of file command.c.
References describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describePublications(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), exec_command_dfo(), free, ignore_slash_options(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listLargeObjects(), listOperatorClasses(), listOperatorFamilies(), listOpFamilyFunctions(), listOpFamilyOperators(), listPartitionedTables(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSDictionaries(), listTSParsers(), listTSTemplates(), listUserMappings(), objectDescription(), OT_NORMAL, permissionsList(), PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, PSQL_CMD_UNKNOWN, psql_scan_slash_option(), success, and true.
Referenced by exec_command().
|
static |
Definition at line 1109 of file command.c.
References describeFunctions(), describeOperators(), free, FUNC_MAX_ARGS, OT_NORMAL, psql_scan_slash_option(), and success.
Referenced by exec_command_d().
|
static |
Definition at line 1363 of file command.c.
References free, ignore_slash_options(), OT_NORMAL, pset, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::queryFout, generate_unaccent_rules::stdout, and value.
Referenced by exec_command().
|
static |
Definition at line 1151 of file command.c.
References canonicalize_path(), copy_previous_query(), do_edit(), expand_tilde(), free, ignore_slash_options(), OT_NORMAL, pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_NEWEDIT, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), and resetPQExpBuffer().
Referenced by exec_command().
|
static |
Definition at line 1247 of file command.c.
References _, appendPQExpBufferStr(), PQExpBufferData::data, do_edit(), EditableFunction, EditableView, free, get_create_object_cmd(), ignore_slash_whole_line(), InvalidOid, lookup_object_oid(), OT_WHOLE_LINE, pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_NEWEDIT, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), resetPQExpBuffer(), and strip_lineno_from_objdesc().
Referenced by exec_command().
|
static |
Definition at line 1858 of file command.c.
References conditional_stack_peek(), conditional_stack_poke(), discard_query_text(), IFSTATE_ELSE_FALSE, IFSTATE_ELSE_TRUE, IFSTATE_FALSE, IFSTATE_IGNORED, IFSTATE_NONE, IFSTATE_TRUE, ignore_boolean_expression(), is_true_boolean_expression(), pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, save_query_text_state(), and success.
Referenced by exec_command().
|
static |
Definition at line 1934 of file command.c.
References conditional_stack_peek(), conditional_stack_poke(), discard_query_text(), IFSTATE_ELSE_FALSE, IFSTATE_ELSE_TRUE, IFSTATE_FALSE, IFSTATE_IGNORED, IFSTATE_NONE, IFSTATE_TRUE, pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, save_query_text_state(), and success.
Referenced by exec_command().
|
static |
Definition at line 1408 of file command.c.
References _psqlSettings::db, _psqlSettings::encoding, encoding, printTableOpt::encoding, free, ignore_slash_options(), OT_NORMAL, pg_encoding_to_char, pg_log_error, _psqlSettings::popt, PQclientEncoding(), PQsetClientEncoding(), pset, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), SetVariable(), printQueryOpt::topt, and _psqlSettings::vars.
Referenced by exec_command().
|
static |
Definition at line 1999 of file command.c.
References Assert, conditional_stack_peek(), conditional_stack_pop(), discard_query_text(), IFSTATE_ELSE_FALSE, IFSTATE_ELSE_TRUE, IFSTATE_FALSE, IFSTATE_IGNORED, IFSTATE_NONE, IFSTATE_TRUE, pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, and success.
Referenced by exec_command().
|
static |
Definition at line 1446 of file command.c.
References _, _psqlSettings::last_error_result, pg_log_error, PQERRORS_VERBOSE, PQfreemem(), PQresultVerboseErrorMessage(), PQSHOW_CONTEXT_ALWAYS, pset, and PSQL_CMD_SKIP_LINE.
Referenced by exec_command().
|
static |
Definition at line 1476 of file command.c.
References do_pset(), free, ignore_slash_options(), OT_NORMAL, _psqlSettings::popt, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::quiet, and success.
Referenced by exec_command().
|
static |
Definition at line 1504 of file command.c.
References expand_tilde(), printTableOpt::expanded, free, _psqlSettings::gfname, _psqlSettings::gsavepopt, OT_FILEPIPE, pg_strdup(), _psqlSettings::popt, process_command_g_options(), pset, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), savePsetInfo(), and printQueryOpt::topt.
Referenced by exec_command().
|
static |
Definition at line 1632 of file command.c.
References _psqlSettings::gdesc_flag, pset, PSQL_CMD_SEND, and PSQL_CMD_SKIP_LINE.
Referenced by exec_command().
|
static |
Definition at line 1649 of file command.c.
References free, ignore_slash_options(), OT_NORMAL, pg_log_error, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), SetVariable(), success, and _psqlSettings::vars.
Referenced by exec_command().
|
static |
Definition at line 1686 of file command.c.
References _psqlSettings::gexec_flag, pset, PSQL_CMD_SEND, and PSQL_CMD_SKIP_LINE.
Referenced by exec_command().
|
static |
Definition at line 1703 of file command.c.
References _psqlSettings::gset_prefix, ignore_slash_options(), OT_NORMAL, pg_strdup(), pset, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, and psql_scan_slash_option().
Referenced by exec_command().
|
static |
Definition at line 1732 of file command.c.
References free, helpSQL(), ignore_slash_whole_line(), OT_WHOLE_LINE, printTableOpt::pager, _psqlSettings::popt, pset, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), and printQueryOpt::topt.
Referenced by exec_command().
|
static |
Definition at line 1752 of file command.c.
References do_pset(), printTableOpt::format, _psqlSettings::popt, PRINT_HTML, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, _psqlSettings::quiet, success, and printQueryOpt::topt.
Referenced by exec_command().
|
static |
Definition at line 1812 of file command.c.
References conditional_active(), conditional_stack_poke(), conditional_stack_push(), IFSTATE_FALSE, IFSTATE_IGNORED, IFSTATE_TRUE, ignore_boolean_expression(), is_true_boolean_expression(), PSQL_CMD_SKIP_LINE, and save_query_text_state().
Referenced by exec_command().
|
static |
Definition at line 1771 of file command.c.
References EXIT_SUCCESS, expand_tilde(), free, ignore_slash_options(), OT_NORMAL, pg_log_error, process_file(), PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), and success.
Referenced by exec_command().
|
static |
Definition at line 2039 of file command.c.
References free, ignore_slash_options(), listAllDbs(), OT_NORMAL, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), success, and true.
Referenced by exec_command().
|
static |
Definition at line 2067 of file command.c.
References do_lo_export(), do_lo_import(), do_lo_unlink(), expand_tilde(), free, ignore_slash_options(), listLargeObjects(), OT_NORMAL, pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, PSQL_CMD_UNKNOWN, psql_scan_slash_option(), and success.
Referenced by exec_command().
|
static |
Definition at line 2145 of file command.c.
References expand_tilde(), free, ignore_slash_filepipe(), OT_FILEPIPE, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), setQFout(), and success.
Referenced by exec_command().
|
static |
Definition at line 2194 of file command.c.
References clean_extended_state(), ignore_slash_options(), OT_NORMAL, pg_log_error, pset, PSQL_CMD_ERROR, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), PSQL_SEND_EXTENDED_PARSE, _psqlSettings::send_mode, and _psqlSettings::stmtName.
Referenced by exec_command().
|
static |
Definition at line 2228 of file command.c.
References _, buf, PromptInterruptContext::canceled, _psqlSettings::db, PromptInterruptContext::enabled, free, ignore_slash_options(), initPQExpBuffer(), PromptInterruptContext::jmpbuf, OT_SQLID, pg_log_error, pg_log_info, pg_strdup(), PGRES_COMMAND_OK, PQchangePassword(), PQclear(), PQerrorMessage(), PQgetvalue(), PQresultStatus(), printfPQExpBuffer(), pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), PSQLexec(), res, sigint_interrupt_enabled, sigint_interrupt_jmp, simple_prompt_extended(), success, termPQExpBuffer(), and user.
Referenced by exec_command().
|
static |
Definition at line 2168 of file command.c.
References _, PQExpBufferData::data, fflush(), PQExpBufferData::len, pset, PSQL_CMD_SKIP_LINE, _psqlSettings::quiet, and generate_unaccent_rules::stdout.
Referenced by exec_command().
|
static |
Definition at line 2304 of file command.c.
References PromptInterruptContext::canceled, PromptInterruptContext::enabled, fflush(), free, gets_fromFile(), ignore_slash_options(), _psqlSettings::inputfile, PromptInterruptContext::jmpbuf, OT_NORMAL, pg_log_error, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), SetVariable(), sigint_interrupt_enabled, sigint_interrupt_jmp, simple_prompt_extended(), generate_unaccent_rules::stdout, success, and _psqlSettings::vars.
Referenced by exec_command().
|
static |
Definition at line 2381 of file command.c.
References do_pset(), free, i, ignore_slash_options(), OT_NORMAL, _psqlSettings::popt, printf, pset, pset_value_string(), PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::quiet, success, and val.
Referenced by exec_command().
|
static |
Definition at line 2436 of file command.c.
References PSQL_CMD_SKIP_LINE, and PSQL_CMD_TERMINATE.
Referenced by exec_command().
|
static |
Definition at line 2450 of file command.c.
References _, pset, PSQL_CMD_SKIP_LINE, psql_scan_reset(), _psqlSettings::quiet, and resetPQExpBuffer().
Referenced by exec_command().
|
static |
Definition at line 2468 of file command.c.
References _, expand_tilde(), free, ignore_slash_options(), OT_NORMAL, printTableOpt::pager, _psqlSettings::popt, printf, printHistory(), pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::quiet, success, and printQueryOpt::topt.
Referenced by exec_command().
|
static |
Definition at line 2495 of file command.c.
References free, ignore_slash_options(), newval, OT_NORMAL, pg_realloc(), pg_strdup(), PrintVariables(), pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), SetVariable(), success, and _psqlSettings::vars.
Referenced by exec_command().
|
static |
Definition at line 2548 of file command.c.
References free, ignore_slash_options(), OT_NORMAL, pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), setenv, success, and unsetenv.
Referenced by exec_command().
|
static |
Definition at line 2596 of file command.c.
References buf, ClosePager(), count_lines_in_buf(), createPQExpBuffer(), destroyPQExpBuffer(), EditableFunction, EditableView, free, get_create_object_cmd(), ignore_slash_whole_line(), InvalidOid, lookup_object_oid(), OT_WHOLE_LINE, output, PageOutput(), pg_log_error, _psqlSettings::popt, print_with_linenumbers(), pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::queryFout, generate_unaccent_rules::stdout, and printQueryOpt::topt.
Referenced by exec_command().
|
static |
Definition at line 3084 of file command.c.
References do_shell(), free, ignore_slash_whole_line(), OT_WHOLE_LINE, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), and success.
Referenced by exec_command().
|
static |
Definition at line 3106 of file command.c.
References free, helpVariables(), ignore_slash_options(), OT_NORMAL, printTableOpt::pager, _psqlSettings::popt, pset, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), slashUsage(), printQueryOpt::topt, and usage().
Referenced by exec_command().
|
static |
Definition at line 2679 of file command.c.
References do_pset(), free, ignore_slash_options(), OT_NORMAL, _psqlSettings::popt, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::quiet, and success.
Referenced by exec_command().
|
static |
Definition at line 2701 of file command.c.
References do_pset(), free, ignore_slash_options(), OT_NORMAL, _psqlSettings::popt, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::quiet, success, and value.
Referenced by exec_command().
|
static |