PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <unistd.h>
#include <signal.h>
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/tableam.h"
#include "access/toast_compression.h"
#include "access/xact.h"
#include "bootstrap/bootstrap.h"
#include "catalog/index.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_type.h"
#include "common/link-canary.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "pg_getopt.h"
#include "storage/bufpage.h"
#include "storage/ipc.h"
#include "storage/proc.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/guc.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/relmapper.h"
Go to the source code of this file.
Data Structures | |
struct | typinfo |
struct | typmap |
struct | _IndexList |
Typedefs | |
typedef struct _IndexList | IndexList |
Functions | |
static void | CheckerModeMain (void) |
static void | bootstrap_signals (void) |
static Form_pg_attribute | AllocateAttribute (void) |
static void | populate_typ_list (void) |
static Oid | gettype (char *type) |
static void | cleanup (void) |
void | BootstrapModeMain (int argc, char *argv[], bool check_only) |
void | boot_openrel (char *relname) |
void | closerel (char *relname) |
void | DefineAttr (char *name, char *type, int attnum, int nullness) |
void | InsertOneTuple (void) |
void | InsertOneValue (char *value, int i) |
void | InsertOneNull (int i) |
void | boot_get_type_io_data (Oid typid, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *typinput, Oid *typoutput) |
void | index_register (Oid heap, Oid ind, const IndexInfo *indexInfo) |
void | build_indices (void) |
Variables | |
Relation | boot_reldesc |
Form_pg_attribute | attrtypes [MAXATTR] |
int | numattr |
static const struct typinfo | TypInfo [] |
static const int | n_types = sizeof(TypInfo) / sizeof(struct typinfo) |
static List * | Typ = NIL |
static struct typmap * | Ap = NULL |
static Datum | values [MAXATTR] |
static bool | Nulls [MAXATTR] |
static MemoryContext | nogc = NULL |
static IndexList * | ILHead = NULL |
typedef struct _IndexList IndexList |
|
static |
Definition at line 884 of file bootstrap.c.
References ATTRIBUTE_FIXED_PART_SIZE, MemoryContextAllocZero(), and TopMemoryContext.
Referenced by boot_openrel(), and DefineAttr().
void boot_get_type_io_data | ( | Oid | typid, |
int16 * | typlen, | ||
bool * | typbyval, | ||
char * | typalign, | ||
char * | typdelim, | ||
Oid * | typioparam, | ||
Oid * | typinput, | ||
Oid * | typoutput | ||
) |
Definition at line 807 of file bootstrap.c.
References typinfo::align, typmap::am_oid, typmap::am_typ, typinfo::byval, typinfo::elem, elog, ERROR, typinfo::inproc, typinfo::len, lfirst, n_types, NIL, OidIsValid, typinfo::outproc, Typ, typalign, and TypInfo.
Referenced by get_type_io_data(), and InsertOneValue().
void boot_openrel | ( | char * | relname | ) |
Definition at line 409 of file bootstrap.c.
References AllocateAttribute(), ATTRIBUTE_FIXED_PART_SIZE, attrtypes, boot_reldesc, closerel(), DEBUG4, elog, i, makeRangeVar(), NAMEDATALEN, NameStr, NIL, NoLock, numattr, populate_typ_list(), RelationData::rd_att, RelationGetNumberOfAttributes, relname, table_openrv(), TupleDescAttr, and Typ.
|
static |
Definition at line 382 of file bootstrap.c.
References Assert, IsUnderPostmaster, pqsignal(), SIG_DFL, SIGHUP, and SIGQUIT.
Referenced by BootstrapModeMain().
void BootstrapModeMain | ( | int | argc, |
char * | argv[], | ||
bool | check_only | ||
) |
Definition at line 197 of file bootstrap.c.
References Assert, attrtypes, BaseInit(), boot_yyparse(), bootstrap_signals(), BootstrapProcessing, BootStrapXLOG(), ChangeToDataDir(), checkDataDir(), CheckerModeMain(), cleanup(), CommitTransactionCommand(), CreateDataDirLockFile(), CreateSharedMemoryAndSemaphores(), elog, ereport, errcode(), errmsg(), ERROR, flag(), getopt(), i, IgnoreSystemIndexes, InitializeFastPathLocks(), InitializeGUCOptions(), InitializeMaxBackends(), InitPostgres(), InitProcess(), InitStandaloneProcess(), InvalidOid, IsUnderPostmaster, MAXATTR, MAXPGPATH, name, NormalProcessing, Nulls, optarg, optind, OutputFileName, ParseLongOption(), pfree(), PG_DATA_CHECKSUM_VERSION, pg_link_canary_is_frontend(), PGC_INTERNAL, PGC_POSTMASTER, PGC_S_ARGV, PGC_S_DYNAMIC_DEFAULT, proc_exit(), progname, psprintf(), pstrdup(), RelationMapFinishBootstrap(), SelectConfigFiles(), SetConfigOption(), SetProcessingMode, StartTransactionCommand(), strlcpy(), userDoption, value, and write_stderr.
Referenced by main().
void build_indices | ( | void | ) |
Definition at line 952 of file bootstrap.c.
References _IndexList::il_heap, _IndexList::il_ind, _IndexList::il_info, _IndexList::il_next, ILHead, index_build(), index_close(), index_open(), NoLock, table_close(), and table_open().
|
static |
Definition at line 179 of file bootstrap.c.
References proc_exit().
Referenced by BootstrapModeMain().
|
static |
Definition at line 683 of file bootstrap.c.
References boot_reldesc, and closerel().
Referenced by BootstrapModeMain(), conninfo_uri_parse_options(), GetConfFilesInDir(), getExtensions(), getPublications(), getSubscriptionTables(), merge_list_bounds(), merge_range_bounds(), pg_GSS_read(), pg_GSS_write(), pg_regexec(), pgoutput_change(), print_aligned_text(), RecordTransactionCommit(), ReorderBufferRestoreChanges(), and ResolveRecoveryConflictWithLock().
void closerel | ( | char * | relname | ) |
Definition at line 454 of file bootstrap.c.
References boot_reldesc, DEBUG4, elog, ERROR, NoLock, RelationGetRelationName, relname, and table_close().
Referenced by boot_openrel(), cleanup(), and DefineAttr().
void DefineAttr | ( | char * | name, |
char * | type, | ||
int | attnum, | ||
int | nullness | ||
) |
Definition at line 491 of file bootstrap.c.
References typinfo::align, AllocateAttribute(), typmap::am_oid, typmap::am_typ, Ap, Assert, attlen, attname, attnotnull, attnum, ATTRIBUTE_FIXED_PART_SIZE, attrtypes, boot_reldesc, BOOTCOL_NULL_AUTO, BOOTCOL_NULL_FORCE_NOT_NULL, BOOTCOL_NULL_FORCE_NULL, typinfo::byval, closerel(), typinfo::collation, DEBUG4, elog, gettype(), i, InvalidCompressionMethod, InvalidOid, typinfo::len, MemSet, name, NameStr, namestrcpy(), NIL, typinfo::oid, OidIsValid, typinfo::storage, Typ, type, TypInfo, and WARNING.
|
static |
Definition at line 736 of file bootstrap.c.
References typmap::am_oid, typmap::am_typ, Ap, DEBUG4, elog, ERROR, i, lfirst, list_free_deep(), n_types, name, NAMEDATALEN, NameStr, NIL, populate_typ_list(), Typ, type, and TypInfo.
Referenced by DefineAttr().
Definition at line 902 of file bootstrap.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, copyObject, IndexInfo::ii_ExclusionOps, IndexInfo::ii_ExclusionProcs, IndexInfo::ii_ExclusionStrats, IndexInfo::ii_Expressions, IndexInfo::ii_ExpressionsState, IndexInfo::ii_Predicate, IndexInfo::ii_PredicateState, _IndexList::il_heap, _IndexList::il_ind, _IndexList::il_info, _IndexList::il_next, ILHead, MemoryContextSwitchTo(), NIL, nogc, and palloc().
Referenced by index_create().
void InsertOneNull | ( | int | i | ) |
Definition at line 665 of file bootstrap.c.
References Assert, boot_reldesc, DEBUG4, elog, ERROR, i, MAXATTR, NameStr, Nulls, PointerGetDatum(), RelationData::rd_att, RelationGetRelationName, TupleDescAttr, and values.
void InsertOneTuple | ( | void | ) |
Definition at line 599 of file bootstrap.c.
References attrtypes, boot_reldesc, CreateTupleDesc(), DEBUG4, elog, heap_form_tuple(), heap_freetuple(), i, Nulls, numattr, pfree(), simple_heap_insert(), and values.
void InsertOneValue | ( | char * | value, |
int | i | ||
) |
Definition at line 627 of file bootstrap.c.
References Assert, boot_get_type_io_data(), boot_reldesc, DEBUG4, elog, ereport, errmsg_internal(), i, MAXATTR, OidInputFunctionCall(), OidOutputFunctionCall(), RelationData::rd_att, TupleDescAttr, typalign, value, and values.
|
static |
Definition at line 696 of file bootstrap.c.
References typmap::am_oid, typmap::am_typ, Assert, ForwardScanDirection, GETSTRUCT, heap_getnext(), lappend(), MemoryContextSwitchTo(), NIL, NoLock, palloc(), table_beginscan_catalog(), table_close(), table_endscan(), table_open(), TopMemoryContext, and Typ.
Referenced by boot_openrel(), and gettype().
|
static |
Definition at line 148 of file bootstrap.c.
Referenced by DefineAttr(), and gettype().
Form_pg_attribute attrtypes[MAXATTR] |
Definition at line 59 of file bootstrap.c.
Referenced by boot_openrel(), BootstrapModeMain(), DefineAttr(), and InsertOneTuple().
Relation boot_reldesc |
Definition at line 57 of file bootstrap.c.
Referenced by boot_openrel(), cleanup(), closerel(), DefineAttr(), InsertOneNull(), InsertOneTuple(), and InsertOneValue().
|
static |
Definition at line 169 of file bootstrap.c.
Referenced by build_indices(), and index_register().
Definition at line 139 of file bootstrap.c.
Referenced by boot_get_type_io_data(), and gettype().
|
static |
Definition at line 153 of file bootstrap.c.
Referenced by index_register().
Definition at line 151 of file bootstrap.c.
Referenced by _SPI_convert_params(), BootstrapModeMain(), InsertOneNull(), InsertOneTuple(), SPI_cursor_open(), SPI_cursor_open_with_args(), SPI_execp(), SPI_execute_plan(), SPI_execute_snapshot(), SPI_execute_with_args(), and SPI_modifytuple().
int numattr |
Definition at line 60 of file bootstrap.c.
Referenced by boot_openrel(), InsertOneTuple(), and tsvector_update_trigger().
Definition at line 147 of file bootstrap.c.
Referenced by boot_get_type_io_data(), boot_openrel(), DefineAttr(), gettype(), and populate_typ_list().
|
static |
Definition at line 60 of file bootstrap.c.
Referenced by boot_get_type_io_data(), DefineAttr(), and gettype().
Definition at line 150 of file bootstrap.c.
Referenced by _bt_build_callback(), _bt_check_unique(), _bt_spool(), _h_spool(), aclexplode(), add_values_to_range(), AddEnumLabel(), AddSubscriptionRelState(), AggregateCreate(), AlterCollation(), AlterDatabaseRefreshColl(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterOperator(), AlterPolicy(), AlterPublicationOptions(), AlterSetting(), AlterSubscription(), AlterTypeRecurse(), apply_returning_filter(), ApplyExtensionUpdates(), array_in(), array_iterate(), array_map(), array_out(), array_replace_internal(), blinsert(), bloomBuildCallback(), BloomFormTuple(), brin_deconstruct_tuple(), brin_deform_tuple(), brin_form_tuple(), brin_metapage_info(), brin_page_items(), brinbuildCallback(), brinbuildCallbackParallel(), brininsert(), bt_metap(), bt_multi_page_stats(), bt_page_print_tuples(), bt_page_stats_internal(), bt_tuple_present_callback(), btinsert(), build_index_value_desc(), build_pgstattuple_type(), build_sorted_items(), build_tuplestore_recursively(), BuildIndexValueDescription(), BuildTupleFromCStrings(), CastCreate(), CatalogIndexInsert(), check_conn_params(), check_exclusion_constraint(), check_exclusion_or_unique_constraint(), clear_subscription_skip_lsn(), CollationCreate(), collectTSQueryValues(), comparetup_index_btree_tiebreak(), compute_index_stats(), compute_partition_hash_value(), compute_scalar_stats(), connect_pg_server(), ConnectDatabase(), connectDatabase(), conninfo_array_parse(), constructConnStr(), ConversionCreate(), copy_replication_slot(), CopyArrayEls(), create_cursor(), CreateAccessMethod(), CreateComments(), CreateConstraintEntry(), CreateForeignDataWrapper(), CreateForeignServer(), CreateForeignTable(), CreateOpFamily(), CreatePolicy(), CreateProceduralLanguage(), CreatePublication(), CreateReplicationSlot(), CreateSharedComments(), CreateStatistics(), CreateSubscription(), CreateTableSpace(), CreateTransform(), CreateTriggerFiringOn(), CreateUserMapping(), crosstab(), dblink_get_notify(), dblink_get_pkey(), DefineOpClass(), DefineTSConfiguration(), DefineTSDictionary(), DefineTSParser(), DefineTSTemplate(), DisableSubscription(), DiscreteKnapsack(), do_connect(), do_text_output_multiline(), do_tup_output(), doConnect(), each_object_field_end(), each_worker_jsonb(), elements_array_element_end(), elements_worker_jsonb(), exec_move_row(), exec_move_row_from_fields(), ExecBuildAggTrans(), ExecBuildSlotPartitionKeyDescription(), ExecCheckIndexConstraints(), ExecComputeStoredGenerated(), ExecEvalMinMax(), ExecEvalXmlExpr(), ExecFilterJunk(), ExecFindPartition(), ExecGrant_Attribute(), ExecGrant_common(), ExecGrant_Largeobject(), ExecGrant_Parameter(), ExecGrant_Relation(), ExecInitExprRec(), ExecInsertIndexTuples(), execute_dml_stmt(), ExtractConnectionOptions(), ExtractReplicaIdentity(), file_acquire_sample_rows(), fill_hba_line(), fill_ident_line(), fillRelOptions(), FillXLogStatsRow(), FormIndexDatum(), FormPartitionKeyDatum(), get_actual_variable_endpoint(), get_altertable_subcmdinfo(), get_available_versions_for_extension(), get_crosstab_tuplestore(), get_matching_hash_bounds(), get_matching_range_bounds(), get_partition_for_tuple(), get_text_array_contents(), GetConfigOptionValues(), GetConnection(), GetWALBlockInfo(), GetWALRecordInfo(), GetWALRecordsInfo(), GetWalStats(), GetXLogSummaryStats(), gin_leafpage_items(), gin_metapage_info(), gin_page_opaque_info(), ginBuildCallback(), gininsert(), gist_page_items(), gist_page_items_bytea(), gist_page_opaque_info(), gistBuildCallback(), gistinsert(), gistSortedBuildCallback(), hash_bitmap_info(), hash_metapage_info(), hash_page_items(), hash_page_stats(), hash_record(), hash_record_extended(), hashbuildCallback(), hashinsert(), heap_compute_data_size(), heap_deform_tuple(), heap_fill_tuple(), heap_form_minimal_tuple(), heap_form_tuple(), heap_modify_tuple(), heap_modify_tuple_by_cols(), heap_page_items(), heap_tuple_infomask_flags(), heapam_index_build_range_scan(), heapam_index_validate_scan(), heapam_relation_copy_for_cluster(), hstore_from_record(), hstore_populate_record(), IdentifySystem(), index_concurrently_swap(), index_deform_tuple(), index_deform_tuple_internal(), index_form_tuple(), index_form_tuple_context(), index_insert(), index_truncate_tuple(), IndexCheckExclusion(), inet_hist_value_sel(), injection_points_stats_fixed(), insert_event_trigger_tuple(), InsertExtensionTuple(), InsertOneNull(), InsertOneTuple(), InsertOneValue(), InsertPgClassTuple(), InsertRule(), intset_flush_buffered_values(), inv_truncate(), inv_write(), LargeObjectCreate(), libpqsrv_connect_params(), LogicalOutputWrite(), logicalrep_write_tuple(), main(), make_tuple_from_result_row(), make_tuple_indirect(), materializeResult(), minmax_multi_init(), NamespaceCreate(), ndistinct_for_combination(), NextCopyFrom(), oid_array_to_list(), OperatorCreate(), OperatorShellMake(), page_header(), ParameterAclCreate(), parse_key_value_arrays(), parseLocalRelOptions(), partition_range_datum_bsearch(), perform_pruning_base_step(), pg_armor(), pg_available_extensions(), pg_available_wal_summaries(), pg_backup_stop(), pg_buffercache_pages(), pg_buffercache_summary(), pg_config(), pg_control_checkpoint(), pg_control_init(), pg_control_recovery(), pg_control_system(), pg_create_logical_replication_slot(), pg_create_physical_replication_slot(), pg_cursor(), pg_event_trigger_ddl_commands(), pg_event_trigger_dropped_objects(), pg_extension_update_paths(), pg_get_catalog_foreign_keys(), pg_get_keywords(), pg_get_multixact_members(), pg_get_object_address(), pg_get_publication_tables(), pg_get_replication_slots(), pg_get_sequence_data(), pg_get_shmem_allocations(), pg_get_wait_events(), pg_get_wal_record_info(), pg_get_wal_resource_managers(), pg_get_wal_summarizer_state(), pg_identify_object(), pg_identify_object_as_address(), pg_input_error_info(), pg_last_committed_xact(), pg_lock_status(), pg_ls_dir(), pg_ls_dir_files(), pg_partition_tree(), pg_prepared_statement(), pg_prepared_xact(), pg_replication_slot_advance(), pg_sequence_parameters(), pg_show_replication_origin_status(), pg_split_walfile_name(), pg_stat_file(), pg_stat_get_activity(), pg_stat_get_archiver(), pg_stat_get_backend_subxact(), pg_stat_get_io(), pg_stat_get_progress_info(), pg_stat_get_recovery_prefetch(), pg_stat_get_replication_slot(), pg_stat_get_slru(), pg_stat_get_subscription(), pg_stat_get_subscription_stats(), pg_stat_get_wal(), pg_stat_get_wal_receiver(), pg_stat_get_wal_senders(), pg_stat_statements_info(), pg_stat_statements_internal(), pg_stats_ext_mcvlist_items(), pg_tablespace_databases(), pg_timezone_abbrevs(), pg_timezone_names(), pg_visibility(), pg_visibility_map(), pg_visibility_map_rel(), pg_visibility_map_summary(), pg_visibility_rel(), pg_wal_summary_contents(), pg_walfile_name_offset(), pg_xact_commit_timestamp_origin(), pgfdw_security_check(), pgp_armor_encode(), pgp_armor_headers(), pgp_extract_armor_headers(), pgrowlocks(), pgstatginindex_internal(), pgstathashindex(), pgstatindex_impl(), pgstattuple_approx_internal(), plperl_build_tuple_result(), pltcl_build_tuple_result(), PLyGenericObject_ToComposite(), PLyMapping_ToComposite(), PLySequence_ToComposite(), populate_record(), postgres_fdw_get_connections_internal(), PQconnectdbParams(), PQconnectStartParams(), PQpingParams(), ProcedureCreate(), prs_process_call(), publication_add_relation(), publication_add_schema(), PutMemoryContextsStatsTupleStore(), RangeCreate(), ReadArrayBinary(), ReadArrayStr(), ReadReplicationSlot(), record_in(), record_out(), record_recv(), record_send(), recordExtensionInitPrivWorker(), reduce_expanded_ranges(), reform_and_rewrite_tuple(), regression_main(), RemoveRoleFromInitPriv(), RemoveRoleFromObjectPolicy(), ReplaceRoleInInitPriv(), replorigin_create(), report_corruption_internal(), SendTablespaceList(), SendXlogRecPtrResult(), serialize_expr_stats(), SetDefaultACL(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepAddDependency(), shdepChangeDep(), show_all_file_settings(), show_all_settings(), ShowAllGUCConfig(), slot_deform_heap_tuple(), spginsert(), spgistBuildCallback(), split_text_accum_result(), sql_conn(), ssl_extension_info(), StartReplication(), statext_mcv_serialize(), statext_store(), StoreAttrDefault(), storeOperators(), StorePartitionKey(), storeProcedures(), StoreSingleInheritance(), test_enc_conversion(), test_huge_distances(), test_predtest(), tfuncLoadRows(), toast_build_flattened_tuple(), toast_delete_external(), TransformGUCArray(), ts_process_call(), tsvector_unnest(), tt_process_call(), tuplesort_putindextuplevalues(), tuplestore_putvalues(), TypeCreate(), TypeShellMake(), unique_key_recheck(), update_attstats(), UpdateIndexRelation(), UpdateSubscriptionRelState(), UpdateTwoPhaseState(), vacuumlo(), ValuesNext(), WaitForLockersMultiple(), and xpath_table().