PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <unistd.h>
#include "command.h"
#include "common.h"
#include "common/logging.h"
#include "common/string.h"
#include "describe.h"
#include "fe_utils/print.h"
#include "getopt_long.h"
#include "help.h"
#include "input.h"
#include "mainloop.h"
#include "settings.h"
Go to the source code of this file.
Data Structures | |
struct | SimpleActionListCell |
struct | SimpleActionList |
struct | adhoc_opts |
Macros | |
#define | SYSPSQLRC "psqlrc" |
#define | PSQLRC ".psqlrc" |
#define | NOPAGER 0 |
#define | PARAMS_ARRAY_SIZE 8 |
Typedefs | |
typedef struct SimpleActionListCell | SimpleActionListCell |
typedef struct SimpleActionList | SimpleActionList |
Enumerations | |
enum | _actions { ACT_SINGLE_QUERY , ACT_SINGLE_SLASH , ACT_FILE } |
Variables | |
PsqlSettings | pset |
#define PARAMS_ARRAY_SIZE 8 |
typedef struct SimpleActionList SimpleActionList |
typedef struct SimpleActionListCell SimpleActionListCell |
enum _actions |
|
static |
Definition at line 875 of file startup.c.
References _psqlSettings::autocommit, newval, ParseVariableBool(), and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 858 of file startup.c.
References newval, pg_free(), and pg_strdup().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1048 of file startup.c.
References Assert, _psqlSettings::comp_case, newval, pg_strcasecmp(), pset, PSQL_COMP_CASE_LOWER, PSQL_COMP_CASE_PRESERVE_LOWER, PSQL_COMP_CASE_PRESERVE_UPPER, PSQL_COMP_CASE_UPPER, and PsqlVarEnumError().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1040 of file startup.c.
References newval, and pg_strdup().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 998 of file startup.c.
References Assert, _psqlSettings::echo_hidden, newval, ParseVariableBool(), pg_strcasecmp(), pset, PSQL_ECHO_HIDDEN_NOEXEC, PSQL_ECHO_HIDDEN_OFF, PSQL_ECHO_HIDDEN_ON, and PsqlVarEnumError().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 978 of file startup.c.
References Assert, _psqlSettings::echo, newval, pg_strcasecmp(), pset, PSQL_ECHO_ALL, PSQL_ECHO_ERRORS, PSQL_ECHO_NONE, PSQL_ECHO_QUERIES, and PsqlVarEnumError().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 970 of file startup.c.
References newval, and pg_strdup().
Referenced by EstablishVariableSpace().
|
static |
|
static |
Definition at line 1198 of file startup.c.
References autocommit_hook(), bool_substitute_hook(), comp_keyword_case_hook(), comp_keyword_case_substitute_hook(), CreateVariableSpace(), echo_hidden_hook(), echo_hook(), echo_substitute_hook(), fetch_count_hook(), fetch_count_substitute_hook(), hide_compression_hook(), hide_tableam_hook(), histcontrol_hook(), histcontrol_substitute_hook(), histfile_hook(), histsize_hook(), histsize_substitute_hook(), ignoreeof_hook(), ignoreeof_substitute_hook(), on_error_rollback_hook(), on_error_stop_hook(), prompt1_hook(), prompt2_hook(), prompt3_hook(), pset, quiet_hook(), SetVariableHooks(), show_all_results_hook(), show_context_hook(), show_context_substitute_hook(), singleline_hook(), singlestep_hook(), _psqlSettings::vars, verbosity_hook(), and verbosity_substitute_hook().
Referenced by main().
|
static |
Definition at line 913 of file startup.c.
References _psqlSettings::fetch_count, newval, ParseVariableNum(), and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 905 of file startup.c.
References newval, and pg_strdup().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1185 of file startup.c.
References _psqlSettings::hide_compression, newval, ParseVariableBool(), and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1192 of file startup.c.
References _psqlSettings::hide_tableam, newval, ParseVariableBool(), and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1077 of file startup.c.
References Assert, hctl_ignoreboth, hctl_ignoredups, hctl_ignorespace, hctl_none, _psqlSettings::histcontrol, newval, pg_strcasecmp(), pset, and PsqlVarEnumError().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1069 of file startup.c.
References newval, and pg_strdup().
Referenced by EstablishVariableSpace().
|
static |
|
static |
Definition at line 937 of file startup.c.
References _psqlSettings::histsize, newval, ParseVariableNum(), and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 929 of file startup.c.
References newval, and pg_strdup().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 964 of file startup.c.
References _psqlSettings::ignoreeof, newval, ParseVariableNum(), and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 943 of file startup.c.
References newval, ParseVariableNum(), and pg_strdup().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 99 of file startup.c.
References filename, _psqlSettings::inputfile, _psqlSettings::lineno, and pset.
Referenced by main().
|
static |
Definition at line 92 of file startup.c.
References fflush(), pset, _psqlSettings::queryFout, and generate_unaccent_rules::stdout.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 126 of file startup.c.
References _, ACT_FILE, ACT_SINGLE_QUERY, ACT_SINGLE_SLASH, SimpleActionListCell::action, Assert, printTableOpt::border, conditional_stack_create(), conditional_stack_destroy(), CONNECTION_BAD, connection_warnings(), _psqlSettings::copyStream, CppAsString2, printTableOpt::csvFieldSep, _psqlSettings::cur_cmd_interactive, _psqlSettings::cur_cmd_source, _psqlSettings::db, options::dbname, _psqlSettings::dead_conn, DEFAULT_CSV_FIELD_SEP, DEFAULT_FIELD_SEP, printTableOpt::default_footer, DEFAULT_PROMPT1, DEFAULT_PROMPT2, DEFAULT_PROMPT3, DEFAULT_RECORD_SEP, _psqlSettings::echo, empty_signal_handler(), _psqlSettings::encoding, printTableOpt::env_columns, error(), EstablishVariableSpace(), exit(), EXIT_BADCONN, EXIT_FAILURE, EXIT_SUCCESS, EXIT_USER, printTableOpt::fieldSep, printTableOpt::format, free, get_progname(), _psqlSettings::getPassword, HandleSlashCmds(), initializeInput(), _psqlSettings::last_error_result, listAllDbs(), log_locus_callback(), log_pre_callback(), _psqlSettings::logfile, MainLoop(), SimpleActionListCell::next, NOPAGER, NoticeProcessor(), _psqlSettings::notty, _psqlSettings::on_error_stop, printTableOpt::pager, printTableOpt::pager_min_lines, PARAMS_ARRAY_SIZE, parse_psql_options(), password, pg_fatal, pg_log_error, PG_LOG_FLAG_TERSE, pg_logging_config(), pg_logging_init(), pg_logging_set_locus_callback(), pg_logging_set_pre_callback(), pg_malloc_array, pg_strdup(), PG_TEXTDOMAIN, _psqlSettings::popt, options::port, PQclear(), PQconnectdbParams(), PQconnectionNeedsPassword(), PQenv2encoding(), PQerrorMessage(), PQfinish(), PQsetNoticeProcessor(), pqsignal(), PQstatus(), PQuser(), PRINT_ALIGNED, printf, process_file(), process_psqlrc(), _psqlSettings::progname, pset, psprintf(), PSQL_CMD_ERROR, PSQL_ECHO_ALL, psql_scan_create(), psql_scan_destroy(), psql_scan_set_passthrough(), psql_scan_setup(), psql_setup_cancel_handler(), PSQLexec(), psqlscan_callbacks, _psqlSettings::queryFout, _psqlSettings::queryFoutPipe, _psqlSettings::quiet, printTableOpt::recordSep, refresh_utf8format(), res, SendQuery(), separator::separator, separator::separator_zero, set_pglocale_pgservice(), setDecimalLocale(), setQFout(), SetVariable(), SetVariableBool(), showVersion(), SIGALRM, SIGCHLD, simple_action_list_append(), simple_prompt(), standard_strings(), printTableOpt::start_table, generate_unaccent_rules::stdout, printTableOpt::stop_table, success, SyncVariables(), printQueryOpt::topt, TRI_DEFAULT, TRI_NO, TRI_YES, printTableOpt::unicode_border_linestyle, printTableOpt::unicode_column_linestyle, printTableOpt::unicode_header_linestyle, UNICODE_LINESTYLE_SINGLE, usage(), options::username, SimpleActionListCell::val, values, and _psqlSettings::vars.
|
static |
Definition at line 1019 of file startup.c.
References Assert, newval, _psqlSettings::on_error_rollback, ParseVariableBool(), pg_strcasecmp(), pset, PSQL_ERROR_ROLLBACK_INTERACTIVE, PSQL_ERROR_ROLLBACK_OFF, PSQL_ERROR_ROLLBACK_ON, and PsqlVarEnumError().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 881 of file startup.c.
References newval, _psqlSettings::on_error_stop, ParseVariableBool(), and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 483 of file startup.c.
References ACT_FILE, ACT_SINGLE_QUERY, ACT_SINGLE_SLASH, options::dbname, DeleteVariable(), do_pset(), exit(), EXIT_FAILURE, EXIT_SUCCESS, printTableOpt::expanded, printTableOpt::fieldSep, printTableOpt::format, free, getopt_long(), _psqlSettings::getPassword, helpVariables(), no_argument, NOPAGER, optarg, optind, optional_argument, pg_fatal, pg_log_error_hint, pg_log_warning, pg_strdup(), _psqlSettings::popt, options::port, PRINT_CSV, PRINT_HTML, PRINT_UNALIGNED, _psqlSettings::progname, pset, _psqlSettings::quiet, printTableOpt::recordSep, required_argument, separator::separator, separator::separator_zero, setQFout(), SetVariable(), SetVariableBool(), showVersion(), simple_action_list_append(), slashUsage(), printTableOpt::tableAttr, printQueryOpt::topt, TRI_NO, TRI_YES, printTableOpt::tuples_only, usage(), options::username, value, and _psqlSettings::vars.
Referenced by main().
|
static |
Definition at line 774 of file startup.c.
References argv0, expand_tilde(), find_my_exec(), get_etc_path(), get_home_path(), MAXPGPATH, my_exec_path, pg_fatal, process_psqlrc_file(), PSQLRC, pstrdup(), snprintf, and SYSPSQLRC.
Referenced by main().
|
static |
Definition at line 808 of file startup.c.
References filename, free, process_file(), and psprintf().
Referenced by process_psqlrc().
|
static |
Definition at line 1098 of file startup.c.
References newval, _psqlSettings::prompt1, and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1105 of file startup.c.
References newval, _psqlSettings::prompt2, and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1112 of file startup.c.
References newval, _psqlSettings::prompt3, and pset.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 887 of file startup.c.
References newval, ParseVariableBool(), pset, and _psqlSettings::quiet.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1150 of file startup.c.
References newval, ParseVariableBool(), pset, and _psqlSettings::show_all_results.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1164 of file startup.c.
References Assert, _psqlSettings::db, newval, pg_strcasecmp(), PQsetErrorContextVisibility(), PQSHOW_CONTEXT_ALWAYS, PQSHOW_CONTEXT_ERRORS, PQSHOW_CONTEXT_NEVER, pset, PsqlVarEnumError(), and _psqlSettings::show_context.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1156 of file startup.c.
References newval, and pg_strdup().
Referenced by EstablishVariableSpace().
|
static |
Definition at line 839 of file startup.c.
Referenced by main(), and parse_psql_options().
|
static |
Definition at line 748 of file startup.c.
References generate_unaccent_rules::action, SimpleActionListCell::action, sort-test::list, SimpleActionListCell::next, pg_malloc_object, pg_strdup(), SimpleActionListCell::val, and val.
Referenced by main(), and parse_psql_options().
|
static |
Definition at line 893 of file startup.c.
References newval, ParseVariableBool(), pset, and _psqlSettings::singleline.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 899 of file startup.c.
References newval, ParseVariableBool(), pset, and _psqlSettings::singlestep.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1127 of file startup.c.
References Assert, _psqlSettings::db, newval, pg_strcasecmp(), PQERRORS_DEFAULT, PQERRORS_SQLSTATE, PQERRORS_TERSE, PQERRORS_VERBOSE, PQsetErrorVerbosity(), pset, PsqlVarEnumError(), and _psqlSettings::verbosity.
Referenced by EstablishVariableSpace().
|
static |
Definition at line 1119 of file startup.c.
References newval, and pg_strdup().
Referenced by EstablishVariableSpace().
PsqlSettings pset |
Definition at line 32 of file startup.c.
Referenced by AcceptResult(), autocommit_hook(), CheckConnection(), clean_extended_state(), ClearOrSaveAllResults(), ClearOrSaveResult(), command_no_begin(), comp_keyword_case_hook(), connection_warnings(), ConnectionUp(), describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describeFunctions(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), DescribeQuery(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), do_connect(), do_copy(), do_lo_export(), do_lo_import(), do_lo_unlink(), do_pset(), do_watch(), echo_hidden_command(), echo_hidden_hook(), echo_hook(), EstablishVariableSpace(), exec_command(), exec_command_a(), exec_command_bind(), exec_command_bind_named(), exec_command_C(), exec_command_close(), exec_command_conninfo(), exec_command_crosstabview(), exec_command_echo(), exec_command_encoding(), 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_parse(), exec_command_password(), exec_command_print(), exec_command_prompt(), exec_command_pset(), exec_command_reset(), exec_command_s(), exec_command_set(), exec_command_sf_sv(), exec_command_slash_command_help(), exec_command_t(), exec_command_T(), exec_command_timing(), exec_command_unset(), exec_command_x(), ExecQueryAndProcessResults(), ExecQueryTuples(), fail_lo_xact(), fetch_count_hook(), finish_lo_xact(), finishInput(), get_create_object_cmd(), get_prompt(), handleCopyIn(), HandleCopyResult(), HandleSlashCmds(), hide_compression_hook(), hide_tableam_hook(), histcontrol_hook(), histsize_hook(), ignoreeof_hook(), indexOfColumn(), initializeInput(), is_superuser(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listLargeObjects(), listOneExtensionContents(), listOperatorClasses(), listOperatorFamilies(), listOpFamilyFunctions(), listOpFamilyOperators(), listPartitionedTables(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), log_locus_callback(), log_pre_callback(), lookup_object_oid(), main(), MainLoop(), objectDescription(), on_error_rollback_hook(), on_error_stop_hook(), parse_psql_options(), parse_slash_copy(), permissionsList(), pg_send_history(), print_lo_result(), printCrosstab(), printGSSInfo(), printHistory(), PrintNotifications(), PrintQueryResult(), PrintQueryStatus(), PrintQueryTuples(), PrintResultInCrosstab(), printSSLInfo(), process_command_g_options(), process_file(), prompt1_hook(), prompt2_hook(), prompt3_hook(), psql_get_variable(), PSQLexec(), PSQLexecWatch(), quiet_hook(), SendQuery(), session_username(), setQFout(), SetResultVariables(), SetShellResultVariables(), SetupGOutput(), show_all_results_hook(), show_context_hook(), singleline_hook(), singlestep_hook(), skip_white_space(), slashUsage(), standard_strings(), start_lo_xact(), StoreQueryTuple(), SyncVariables(), UnsyncVariables(), usage(), validateSQLNamePattern(), and verbosity_hook().