|
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 } |
Variables | |
| static bool | restricted |
| static char * | restrict_key |
| Enumerator | |
|---|---|
| EditableFunction | |
| EditableView | |
|
static |
Definition at line 4991 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().
Definition at line 5047 of file command.c.
References fb(), UNICODE_LINESTYLE_DOUBLE, and UNICODE_LINESTYLE_SINGLE.
Referenced by printPsetInfo(), and pset_value_string().
Definition at line 4442 of file command.c.
References _, _psqlSettings::db, fb(), 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 3847 of file command.c.
References appendPQExpBufferStr(), and fb().
Referenced by exec_command(), exec_command_edit(), and exec_command_watch().
|
static |
Definition at line 6466 of file command.c.
Referenced by exec_command_sf_sv().
|
static |
Definition at line 3821 of file command.c.
References Assert, conditional_stack_get_paren_depth(), conditional_stack_get_query_len(), fb(), len, and psql_scan_set_paren_depth().
Referenced by exec_command_elif(), exec_command_else(), and exec_command_endif().
|
static |
Definition at line 3916 of file command.c.
References _, Assert, CONNECTION_OK, connection_warnings(), _psqlSettings::cur_cmd_interactive, _psqlSettings::db, dbname, _psqlSettings::dead_conn, errmsg(), fb(), _psqlSettings::getPassword, is_unixsock_path(), JsonPathKeyword::keyword, keywords, 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, values, and wait_until_connected().
Referenced by exec_command_connect().
|
static |
Definition at line 4729 of file command.c.
References appendPQExpBufferChar(), appendPQExpBufferStr(), before(), editFile(), error(), fb(), fd(), MAXPGPATH, PG_BINARY_R, pg_log_error, resetPQExpBuffer(), snprintf, stat, and strerror.
Referenced by exec_command_edit(), and exec_command_ef_ev().
Definition at line 5077 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, printQueryOpt::falsePrint, fb(), printTableOpt::fieldSep, 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, printQueryOpt::truePrint, 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().
Definition at line 5864 of file command.c.
References DEFAULT_SHELL, fb(), free, pg_log_error, psprintf(), and SetShellResultVariables().
Referenced by exec_command_shell_escape().
Definition at line 5915 of file command.c.
References _, cancel_pressed, disable_sigpipe_trap(), EINTR, fb(), fprintf, i, ITIMER_REAL, Min, pg_free(), pg_log_error, pg_malloc(), pg_usleep(), _psqlSettings::popt, pset, PSQLexecWatch(), restore_sigpipe_trap(), setitimer(), SIGALRM, SIGCHLD, sleep_ms, and snprintf.
Referenced by exec_command_watch().
Definition at line 6156 of file command.c.
References _, _psqlSettings::echo_hidden, fb(), fprintf, _psqlSettings::logfile, printf, pset, PSQL_ECHO_HIDDEN_NOEXEC, and PSQL_ECHO_HIDDEN_OFF.
Referenced by get_create_object_cmd(), and lookup_object_oid().
Definition at line 4647 of file command.c.
References Assert, DEFAULT_EDITOR, DEFAULT_EDITOR_LINENUMBER_ARG, fb(), free, pg_log_error, and psprintf().
Referenced by do_edit().
|
static |
Definition at line 315 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_prepared(), 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_endpipeline(), exec_command_errverbose(), exec_command_f(), exec_command_flush(), exec_command_flushrequest(), exec_command_g(), exec_command_gdesc(), exec_command_getenv(), exec_command_getresults(), 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_restrict(), exec_command_s(), exec_command_sendpipeline(), exec_command_set(), exec_command_setenv(), exec_command_sf_sv(), exec_command_shell_escape(), exec_command_slash_command_help(), exec_command_startpipeline(), exec_command_syncpipeline(), exec_command_t(), exec_command_T(), exec_command_timing(), exec_command_unrestrict(), exec_command_unset(), exec_command_watch(), exec_command_write(), exec_command_x(), exec_command_z(), fb(), is_branching_command(), pg_log_warning, pg_strcasecmp(), pset, PSQL_CMD_SEND, and PSQL_CMD_UNKNOWN.
Referenced by HandleSlashCmds().
|
static |
Definition at line 501 of file command.c.
References do_pset(), fb(), 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 520 of file command.c.
References _psqlSettings::bind_nparams, _psqlSettings::bind_params, clean_extended_state(), fb(), 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 556 of file command.c.
References _psqlSettings::bind_nparams, _psqlSettings::bind_params, clean_extended_state(), fb(), 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 605 of file command.c.
References do_pset(), fb(), 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 691 of file command.c.
References _, fb(), 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 755 of file command.c.
References clean_extended_state(), fb(), 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 638 of file command.c.
References do_connect(), fb(), 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 788 of file command.c.
References _, _psqlSettings::db, fb(), is_unixsock_path(), _psqlSettings::logfile, pfree(), _psqlSettings::popt, PQbackendPID(), PQconnectionUsedGSSAPI(), PQconnectionUsedPassword(), PQdb(), PQfullProtocolVersion(), PQhost(), PQhostaddr(), PQoptions(), PQparameterStatus(), PQport(), PQsslAttribute(), PQsslInUse(), PQuser(), printf, printTable(), printTableAddCell(), printTableAddHeader(), printTableCleanup(), printTableInit(), pset, psprintf(), PSQL_CMD_SKIP_LINE, _psqlSettings::queryFout, and printQueryOpt::topt.
Referenced by exec_command().
|
static |
Definition at line 963 of file command.c.
References do_copy(), fb(), 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 985 of file command.c.
References fb(), print_copyright(), and PSQL_CMD_SKIP_LINE.
Referenced by exec_command().
|
static |
Definition at line 997 of file command.c.
References _psqlSettings::crosstab_flag, _psqlSettings::ctv_args, fb(), 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 1021 of file command.c.
References describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describePublications(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), exec_command_dfo(), printTableOpt::expanded, fb(), 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(), _psqlSettings::popt, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, PSQL_CMD_UNKNOWN, psql_scan_slash_option(), success, printQueryOpt::topt, and true.
Referenced by exec_command().
|
static |
Definition at line 1305 of file command.c.
References describeFunctions(), describeOperators(), fb(), free, FUNC_MAX_ARGS, OT_NORMAL, psql_scan_slash_option(), and success.
Referenced by exec_command_d().
|
static |
Definition at line 1559 of file command.c.
References fb(), free, ignore_slash_options(), OT_NORMAL, pset, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::queryFout, and value.
Referenced by exec_command().
|
static |
Definition at line 1347 of file command.c.
References canonicalize_path_enc(), copy_previous_query(), do_edit(), _psqlSettings::encoding, expand_tilde(), fb(), free, ignore_slash_options(), OT_NORMAL, pg_log_error, pset, PSQL_CMD_ERROR, PSQL_CMD_NEWEDIT, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), and resetPQExpBuffer().
Referenced by exec_command().
|
static |
Definition at line 1443 of file command.c.
References _, appendPQExpBufferStr(), do_edit(), EditableFunction, EditableView, fb(), 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 2150 of file command.c.
References conditional_stack_peek(), conditional_stack_poke(), discard_query_text(), fb(), 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 2226 of file command.c.
References conditional_stack_peek(), conditional_stack_poke(), discard_query_text(), fb(), 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 1604 of file command.c.
References _psqlSettings::db, encoding, _psqlSettings::encoding, printTableOpt::encoding, fb(), 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(), setFmtEncoding(), SetVariable(), printQueryOpt::topt, and _psqlSettings::vars.
Referenced by exec_command().
|
static |
Definition at line 2291 of file command.c.
References Assert, conditional_stack_peek(), conditional_stack_pop(), discard_query_text(), fb(), 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 3098 of file command.c.
References fb(), ignore_slash_options(), pset, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, PSQL_SEND_END_PIPELINE_MODE, and _psqlSettings::send_mode.
Referenced by exec_command().
|
static |
Definition at line 1643 of file command.c.
References _, fb(), _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 1673 of file command.c.
References do_pset(), fb(), 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 1695 of file command.c.
References fb(), ignore_slash_options(), pset, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, PSQL_SEND_FLUSH, and _psqlSettings::send_mode.
Referenced by exec_command().
|
static |
Definition at line 1714 of file command.c.
References fb(), ignore_slash_options(), pset, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, PSQL_SEND_FLUSH_REQUEST, and _psqlSettings::send_mode.
Referenced by exec_command().
|
static |
Definition at line 1739 of file command.c.
References clean_extended_state(), _psqlSettings::db, expand_tilde(), printTableOpt::expanded, fb(), free, _psqlSettings::gfname, _psqlSettings::gsavepopt, OT_FILEPIPE, pg_log_error, pg_strdup(), _psqlSettings::popt, PQ_PIPELINE_OFF, PQpipelineStatus(), process_command_g_options(), pset, PSQL_CMD_ERROR, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), savePsetInfo(), and printQueryOpt::topt.
Referenced by exec_command().
|
static |
Definition at line 1875 of file command.c.
References fb(), _psqlSettings::gdesc_flag, pset, PSQL_CMD_SEND, and PSQL_CMD_SKIP_LINE.
Referenced by exec_command().
|
static |
Definition at line 1892 of file command.c.
References fb(), 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 1929 of file command.c.
References fb(), 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_GET_RESULTS, _psqlSettings::requested_results, and _psqlSettings::send_mode.
Referenced by exec_command().
|
static |
Definition at line 1965 of file command.c.
References clean_extended_state(), _psqlSettings::db, fb(), _psqlSettings::gexec_flag, pg_log_error, PQ_PIPELINE_OFF, PQpipelineStatus(), pset, PSQL_CMD_ERROR, PSQL_CMD_SEND, and PSQL_CMD_SKIP_LINE.
Referenced by exec_command().
|
static |
Definition at line 1988 of file command.c.
References clean_extended_state(), _psqlSettings::db, fb(), _psqlSettings::gset_prefix, ignore_slash_options(), OT_NORMAL, pg_log_error, pg_strdup(), PQ_PIPELINE_OFF, PQpipelineStatus(), pset, PSQL_CMD_ERROR, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, and psql_scan_slash_option().
Referenced by exec_command().
|
static |
Definition at line 2024 of file command.c.
References fb(), 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 2044 of file command.c.
References do_pset(), fb(), 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 2104 of file command.c.
References conditional_active(), conditional_stack_poke(), conditional_stack_push(), fb(), 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 2063 of file command.c.
References EXIT_SUCCESS, expand_tilde(), fb(), 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 2331 of file command.c.
References printTableOpt::expanded, fb(), free, ignore_slash_options(), listAllDbs(), OT_NORMAL, _psqlSettings::popt, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), success, printQueryOpt::topt, and true.
Referenced by exec_command().
|
static |
Definition at line 2368 of file command.c.
References do_lo_export(), do_lo_import(), do_lo_unlink(), expand_tilde(), printTableOpt::expanded, fb(), free, ignore_slash_options(), listLargeObjects(), OT_NORMAL, pg_log_error, _psqlSettings::popt, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, PSQL_CMD_UNKNOWN, psql_scan_slash_option(), success, printQueryOpt::topt, and true.
Referenced by exec_command().
|
static |
Definition at line 2459 of file command.c.
References expand_tilde(), fb(), 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 2508 of file command.c.
References clean_extended_state(), fb(), 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 2542 of file command.c.
References _, buf, _psqlSettings::db, fb(), free, ignore_slash_options(), initPQExpBuffer(), 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(), sigint_interrupt_enabled, sigint_interrupt_jmp, simple_prompt_extended(), success, termPQExpBuffer(), and user.
Referenced by exec_command().
|
static |
Definition at line 2482 of file command.c.
References _, fb(), pset, PSQL_CMD_SKIP_LINE, and _psqlSettings::quiet.
Referenced by exec_command().
|
static |
Definition at line 2618 of file command.c.
References fb(), 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(), success, and _psqlSettings::vars.
Referenced by exec_command().
|
static |
Definition at line 2695 of file command.c.
References do_pset(), fb(), 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 2751 of file command.c.
References fb(), PSQL_CMD_SKIP_LINE, and PSQL_CMD_TERMINATE.
Referenced by exec_command().
|
static |
Definition at line 2765 of file command.c.
References _, fb(), pset, PSQL_CMD_SKIP_LINE, psql_scan_reset(), _psqlSettings::quiet, and resetPQExpBuffer().
Referenced by exec_command().
|
static |
Definition at line 2783 of file command.c.
References Assert, fb(), ignore_slash_options(), OT_NORMAL, pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), pstrdup(), restrict_key, and restricted.
Referenced by exec_command().
|
static |
Definition at line 2812 of file command.c.
References _, expand_tilde(), fb(), 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 2839 of file command.c.
References clean_extended_state(), _psqlSettings::db, fb(), ignore_slash_options(), pg_log_error, PQ_PIPELINE_OFF, PQpipelineStatus(), pset, PSQL_CMD_ERROR, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, PSQL_SEND_EXTENDED_QUERY_PARAMS, PSQL_SEND_EXTENDED_QUERY_PREPARED, and _psqlSettings::send_mode.
Referenced by exec_command().
|
static |
Definition at line 2876 of file command.c.
References fb(), 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 2929 of file command.c.
References fb(), 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 2977 of file command.c.
References buf, ClosePager(), count_lines_in_buf(), createPQExpBuffer(), destroyPQExpBuffer(), EditableFunction, EditableView, fb(), 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, and printQueryOpt::topt.
Referenced by exec_command().
|
static |
Definition at line 3580 of file command.c.
References do_shell(), fb(), 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 3602 of file command.c.
References fb(), 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 3060 of file command.c.
References fb(), ignore_slash_options(), pset, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, PSQL_SEND_START_PIPELINE_MODE, and _psqlSettings::send_mode.
Referenced by exec_command().
|
static |
Definition at line 3079 of file command.c.
References fb(), ignore_slash_options(), pset, PSQL_CMD_SEND, PSQL_CMD_SKIP_LINE, PSQL_SEND_PIPELINE_SYNC, and _psqlSettings::send_mode.
Referenced by exec_command().
|
static |
Definition at line 3117 of file command.c.
References do_pset(), fb(), 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 3139 of file command.c.
References do_pset(), fb(), 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 |
Definition at line 3161 of file command.c.
References _, fb(), free, ignore_slash_options(), OT_NORMAL, ParseVariableBool(), pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), _psqlSettings::quiet, success, and _psqlSettings::timing.
Referenced by exec_command().
|
static |
Definition at line 3193 of file command.c.
References fb(), ignore_slash_options(), OT_NORMAL, pfree(), pg_log_error, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), restrict_key, and restricted.
Referenced by exec_command().
|
static |
Definition at line 3233 of file command.c.
References fb(), 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 3365 of file command.c.
References clean_extended_state(), copy_previous_query(), _psqlSettings::db, do_watch(), fb(), free, ignore_slash_options(), OT_NORMAL, pg_log_error, PQ_PIPELINE_OFF, PQpipelineStatus(), pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_reset(), psql_scan_slash_option(), resetPQExpBuffer(), strtoint(), success, and _psqlSettings::watch_interval.
Referenced by exec_command().
|
static |
Definition at line 3263 of file command.c.
References canonicalize_path_enc(), disable_sigpipe_trap(), _psqlSettings::encoding, expand_tilde(), fb(), fd(), fprintf, free, ignore_slash_filepipe(), OT_FILEPIPE, pg_log_error, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), restore_sigpipe_trap(), SetShellResultVariables(), and wait_result_to_str().
Referenced by exec_command().
|
static |
Definition at line 3521 of file command.c.
References do_pset(), fb(), 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 3543 of file command.c.
References printTableOpt::expanded, fb(), free, ignore_slash_options(), OT_NORMAL, permissionsList(), _psqlSettings::popt, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), success, printQueryOpt::topt, and true.
Referenced by exec_command().
|
static |
Definition at line 3673 of file command.c.
References appendPQExpBufferChar(), appendPQExpBufferStr(), createPQExpBuffer(), fb(), free, OT_NORMAL, psql_scan_slash_option(), and value.
Referenced by ignore_boolean_expression(), and is_true_boolean_expression().
|
static |
Definition at line 6248 of file command.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), appendReloptionsArray(), buf, createPQExpBuffer(), PQExpBufferData::data, _psqlSettings::db, destroyPQExpBuffer(), echo_hidden_command(), EditableFunction, EditableView, _psqlSettings::encoding, fb(), fmtId(), minimal_error_message(), pg_log_error, PGRES_TUPLES_OK, PQclear, PQexec(), PQgetvalue, PQntuples, PQresultStatus, printfPQExpBuffer(), pset, relname, resetPQExpBuffer(), standard_strings(), and _psqlSettings::sversion.
Referenced by exec_command_ef_ev(), and exec_command_sf_sv().
| backslashResult HandleSlashCmds | ( | PsqlScanState | scan_state, |
| ConditionalStack | cstack, | ||
| PQExpBuffer | query_buf, | ||
| PQExpBuffer | previous_buf | ||
| ) |
Definition at line 231 of file command.c.
References arg, Assert, conditional_active(), conditional_stack_pop(), conditional_stack_push(), _psqlSettings::cur_cmd_interactive, exec_command(), fb(), free, IFSTATE_IGNORED, OT_NORMAL, OT_WHOLE_LINE, pg_log_error, pg_log_error_hint, pg_log_warning, pset, PSQL_CMD_ERROR, PSQL_CMD_UNKNOWN, psql_scan_slash_command(), psql_scan_slash_command_end(), psql_scan_slash_option(), _psqlSettings::queryFout, and restricted.
Referenced by main(), and MainLoop().
|
static |
Definition at line 3720 of file command.c.
References buf, destroyPQExpBuffer(), fb(), and gather_boolean_expression().
Referenced by exec_command_elif(), and exec_command_if().
|
static |
Definition at line 3753 of file command.c.
References arg, fb(), free, OT_FILEPIPE, and psql_scan_slash_option().
Referenced by exec_command_out(), and exec_command_write().
|
static |
Definition at line 3736 of file command.c.
References arg, fb(), free, OT_NORMAL, and psql_scan_slash_option().
Referenced by exec_command_bind(), exec_command_bind_named(), exec_command_C(), exec_command_cd(), exec_command_close_prepared(), exec_command_connect(), exec_command_crosstabview(), exec_command_d(), exec_command_echo(), exec_command_edit(), exec_command_encoding(), exec_command_endpipeline(), exec_command_f(), exec_command_flush(), exec_command_flushrequest(), exec_command_getenv(), exec_command_getresults(), exec_command_gset(), exec_command_include(), exec_command_list(), exec_command_lo(), exec_command_parse(), exec_command_password(), exec_command_prompt(), exec_command_pset(), exec_command_restrict(), exec_command_s(), exec_command_sendpipeline(), exec_command_set(), exec_command_setenv(), exec_command_slash_command_help(), exec_command_startpipeline(), exec_command_syncpipeline(), exec_command_t(), exec_command_T(), exec_command_timing(), exec_command_unrestrict(), exec_command_unset(), exec_command_watch(), exec_command_x(), and exec_command_z().
|
static |
Definition at line 3773 of file command.c.
References arg, fb(), free, OT_WHOLE_LINE, and psql_scan_slash_option().
Referenced by exec_command_copy(), exec_command_ef_ev(), exec_command_help(), exec_command_sf_sv(), and exec_command_shell_escape().
|
static |
Definition at line 3703 of file command.c.
References buf, destroyPQExpBuffer(), fb(), gather_boolean_expression(), name, ParseVariableBool(), success, and value.
Referenced by exec_command_elif(), and exec_command_if().
|
static |
Definition at line 6188 of file command.c.
References appendPQExpBuffer(), appendPQExpBufferStr(), appendStringLiteralConn(), atooid, createPQExpBuffer(), PQExpBufferData::data, _psqlSettings::db, destroyPQExpBuffer(), echo_hidden_command(), EditableFunction, EditableView, fb(), minimal_error_message(), PGRES_TUPLES_OK, PQclear, PQexec(), PQgetvalue, PQntuples, PQresultStatus, and pset.
Referenced by exec_command_ef_ev(), and exec_command_sf_sv().
Definition at line 6538 of file command.c.
References appendPQExpBufferChar(), appendPQExpBufferStr(), createPQExpBuffer(), PQExpBufferData::data, destroyPQExpBuffer(), fb(), PG_DIAG_MESSAGE_PRIMARY, PG_DIAG_SEVERITY, pg_log_error, PQresultErrorField, and printfPQExpBuffer().
Referenced by get_create_object_cmd(), and lookup_object_oid().
Definition at line 6496 of file command.c.
References fb(), fprintf, and output.
Referenced by exec_command_sf_sv().
Definition at line 4529 of file command.c.
References _, _psqlSettings::db, PQgssEncInUse(), printf, and pset.
Referenced by connection_warnings().
|
static |
Definition at line 5450 of file command.c.
References _, _align2string(), _unicode_linestyle2string(), Assert, printTableOpt::border, printTableOpt::columns, printTableOpt::csvFieldSep, printTableOpt::default_footer, printTableOpt::expanded, printTableOpt::expanded_header_exact_width, printTableOpt::expanded_header_width_type, printQueryOpt::falsePrint, fb(), printTableOpt::fieldSep, printTableOpt::format, get_line_style(), printTextFormat::name, ngettext, printQueryOpt::nullPrint, printTableOpt::numericLocale, printTableOpt::pager, printTableOpt::pager_min_lines, pg_log_error, PRINT_XHEADER_COLUMN, PRINT_XHEADER_EXACT_WIDTH, PRINT_XHEADER_FULL, PRINT_XHEADER_PAGE, printf, printTableOpt::recordSep, separator::separator, separator::separator_zero, printTableOpt::tableAttr, printQueryOpt::title, printQueryOpt::topt, printQueryOpt::truePrint, printTableOpt::tuples_only, printTableOpt::unicode_border_linestyle, printTableOpt::unicode_column_linestyle, and printTableOpt::unicode_header_linestyle.
Referenced by do_pset().
Definition at line 4501 of file command.c.
References _, _psqlSettings::db, fb(), PQsslAttribute(), PQsslInUse(), printf, and pset.
Referenced by connection_warnings().
|
static |
Definition at line 1800 of file command.c.
References do_pset(), fb(), free, _psqlSettings::gsavepopt, OT_NORMAL, pg_log_error, _psqlSettings::popt, pset, PSQL_CMD_ERROR, PSQL_CMD_SKIP_LINE, psql_scan_slash_option(), restorePsetInfo(), savePsetInfo(), and success.
Referenced by exec_command_g().
Definition at line 4924 of file command.c.
References canonicalize_path_enc(), _psqlSettings::encoding, EXIT_FAILURE, fb(), fd(), filename, get_parent_directory(), has_drive_prefix(), _psqlSettings::inputfile, is_absolute_path, join_path_components(), MainLoop(), MAXPGPATH, PG_BINARY_R, pg_log_error, PG_LOG_FLAG_TERSE, pg_logging_config(), pset, relpath, and strlcpy().
Referenced by exec_command_include().
Definition at line 3865 of file command.c.
References _, fb(), free, PromptInterruptContext::jmpbuf, psprintf(), sigint_interrupt_enabled, sigint_interrupt_jmp, simple_prompt_extended(), and username.
Referenced by do_connect().
Definition at line 5733 of file command.c.
References fb(), pg_malloc(), and str.
Referenced by pset_value_string().
|
static |
Definition at line 5771 of file command.c.
References _align2string(), _unicode_linestyle2string(), Assert, printTableOpt::border, printTableOpt::columns, printTableOpt::csvFieldSep, printTableOpt::default_footer, printTableOpt::expanded, printTableOpt::expanded_header_exact_width, printTableOpt::expanded_header_width_type, printQueryOpt::falsePrint, fb(), printTableOpt::fieldSep, printTableOpt::format, get_line_style(), printTextFormat::name, printQueryOpt::nullPrint, printTableOpt::numericLocale, printTableOpt::pager, printTableOpt::pager_min_lines, PRINT_XHEADER_COLUMN, PRINT_XHEADER_FULL, PRINT_XHEADER_PAGE, pset_bool_string(), pset_quoted_string(), psprintf(), pstrdup(), printTableOpt::recordSep, separator::separator, separator::separator_zero, snprintf, printTableOpt::tableAttr, printQueryOpt::title, printQueryOpt::topt, printQueryOpt::truePrint, printTableOpt::tuples_only, printTableOpt::unicode_border_linestyle, printTableOpt::unicode_column_linestyle, and printTableOpt::unicode_header_linestyle.
Referenced by exec_command_pset().
|
static |
Definition at line 3633 of file command.c.
References fb(), free, OT_SQLIDHACK, and psql_scan_slash_option().
Referenced by exec_command_connect().
| void restorePsetInfo | ( | printQueryOpt * | popt, |
| printQueryOpt * | save | ||
| ) |
Definition at line 5700 of file command.c.
References Assert, fb(), printTableOpt::fieldSep, printQueryOpt::footers, free, printQueryOpt::nullPrint, printTableOpt::recordSep, separator::separator, printTableOpt::tableAttr, printQueryOpt::title, printQueryOpt::topt, and printQueryOpt::translate_columns.
Referenced by process_command_g_options(), and SendQuery().
|
static |
Definition at line 3801 of file command.c.
References conditional_stack_set_paren_depth(), conditional_stack_set_query_len(), fb(), and psql_scan_get_paren_depth().
Referenced by exec_command_elif(), exec_command_else(), and exec_command_if().
| printQueryOpt * savePsetInfo | ( | const printQueryOpt * | popt | ) |
Definition at line 5664 of file command.c.
References Assert, fb(), printTableOpt::fieldSep, printQueryOpt::footers, printQueryOpt::nullPrint, pg_malloc(), pg_strdup(), printTableOpt::recordSep, separator::separator, printTableOpt::tableAttr, printQueryOpt::title, printQueryOpt::topt, and printQueryOpt::translate_columns.
Referenced by exec_command_g(), and process_command_g_options().
|
static |
Definition at line 5034 of file command.c.
References fb(), pg_strncasecmp(), UNICODE_LINESTYLE_DOUBLE, UNICODE_LINESTYLE_SINGLE, and value.
Referenced by do_pset().
Definition at line 6408 of file command.c.
References fb(), and pg_log_error.
Referenced by exec_command_ef_ev().
Definition at line 4570 of file command.c.
References _psqlSettings::db, _psqlSettings::encoding, printTableOpt::encoding, fb(), formatPGVersionNumber(), get_conninfo_value(), pg_encoding_to_char, pg_free(), _psqlSettings::popt, PQclientEncoding(), PQdb(), PQhost(), PQparameterStatus(), PQport(), PQserverVersion(), PQsetErrorContextVisibility(), PQsetErrorVerbosity(), PQuser(), pset, server_version, setFmtEncoding(), SetVariable(), _psqlSettings::show_context, snprintf, _psqlSettings::sversion, printQueryOpt::topt, _psqlSettings::vars, and _psqlSettings::verbosity.
Referenced by CheckConnection(), do_connect(), and main().
Definition at line 4625 of file command.c.
References fb(), pset, SetVariable(), and _psqlSettings::vars.
Referenced by CheckConnection(), and do_connect().
Definition at line 4380 of file command.c.
References cancel_pressed, conn, end_time, fb(), pg_unreachable, PGRES_POLLING_ACTIVE, PGRES_POLLING_FAILED, PGRES_POLLING_OK, PGRES_POLLING_READING, PGRES_POLLING_WRITING, PQconnectPoll(), PQgetCurrentTimeUSec(), PQsocket(), and PQsocketPoll().
Referenced by do_connect().
|
static |
Definition at line 200 of file command.c.
Referenced by exec_command_restrict(), and exec_command_unrestrict().
|
static |
Definition at line 199 of file command.c.
Referenced by exec_command_restrict(), exec_command_unrestrict(), HandleSlashCmds(), is_simple_subquery(), jointree_contains_lateral_outer_refs(), load_file(), and load_libraries().