#include "postgres.h"
#include <time.h>
#include "utils/datetime.h"
#include "lib/stringinfo.h"
Go to the source code of this file.
Defines | |
#define | FRONTEND 1 |
Functions | |
pg_time_t | timestamptz_to_time_t (TimestampTz t) |
const char * | timestamptz_to_str (TimestampTz dt) |
void | appendStringInfo (StringInfo str, const char *fmt,...) |
void | appendStringInfoString (StringInfo str, const char *string) |
void | appendStringInfoChar (StringInfo str, char ch) |
void appendStringInfo | ( | StringInfo | str, | |
const char * | fmt, | |||
... | ||||
) |
Definition at line 80 of file compat.c.
Referenced by _outAConst(), _outAExpr(), _outAgg(), _outBitmapset(), _outBoolExpr(), _outConst(), _outConstraint(), _outDatum(), _outGroup(), _outList(), _outMergeAppend(), _outMergeJoin(), _outNode(), _outPathInfo(), _outQuery(), _outRecursiveUnion(), _outSetOp(), _outSort(), _outToken(), _outUnique(), _outValue(), _outWindowAgg(), appendStringInfoChar(), appendStringInfoString(), array_to_text_internal(), bqarr_in(), btree_desc(), build_tuplestore_recursively(), BuildIndexValueDescription(), checkSharedDependencies(), clog_desc(), ConvertTriggerToFK(), create_cursor(), cube_out(), database_to_xml_internal(), dbase_desc(), dblink_close(), dblink_fdw_validator(), dblink_fetch(), dblink_open(), DeadLockReport(), decompile_column_index_array(), deparseAnalyzeSizeSql(), deparseArrayExpr(), deparseBoolExpr(), deparseConst(), deparseFuncExpr(), deparseInsertSql(), deparseOperatorName(), deparseParam(), deparseRelabelType(), deparseRelation(), deparseScalarArrayOpExpr(), deparseUpdateSql(), deparseVar(), desc_node(), DescribeLockTag(), do_pg_start_backup(), errdetail_params(), escape_json(), ExecEvalXml(), execute_extension_script(), ExplainIndexScanDetails(), ExplainNode(), ExplainOnePlan(), ExplainOpenGroup(), ExplainProperty(), ExplainPropertyList(), ExplainTargetRel(), ExportSnapshot(), file_fdw_validator(), flatten_set_variable_args(), format_node_dump(), format_operator_internal(), format_procedure_internal(), fsm_page_contents(), funcname_signature_string(), generate_operator_name(), get_agg_expr(), get_basic_select_query(), get_coercion_expr(), get_column_alias_list(), get_connect_string(), get_const_collation(), get_const_expr(), get_delete_query_def(), get_from_clause_coldeflist(), get_from_clause_item(), get_func_expr(), get_insert_query_def(), get_opclass_name(), get_oper_expr(), get_parameter(), get_query_def(), get_rule_expr(), get_rule_orderby(), get_rule_sortgroupclause(), get_rule_windowclause(), get_select_query_def(), get_setop_query(), get_sql_delete(), get_sql_insert(), get_sql_update(), get_sublink_expr(), get_target_list(), get_tuple_of_interest(), get_update_query_def(), get_utility_query_def(), get_variable(), get_windowfunc_expr(), getObjectDescription(), getObjectIdentity(), getObjectTypeDescription(), getOpFamilyDescription(), getOpFamilyIdentity(), getProcedureTypeDescription(), getRelationDescription(), getRelationIdentity(), getRelationTypeDescription(), gin_desc(), gist_desc(), heap2_desc(), heap_desc(), incompatible_module_error(), initialize_worker_spi(), KnownAssignedXidsDisplay(), log_line_prefix(), make_ruledef(), make_viewdef(), map_multipart_sql_identifier_to_xml_name(), map_sql_catalog_to_xmlschema_types(), map_sql_identifier_to_xml_name(), map_sql_schema_to_xmlschema_types(), map_sql_table_to_xmlschema(), map_sql_type_to_xml_name(), map_sql_type_to_xmlschema_type(), map_sql_typecoll_to_xmlschema_types(), multixact_desc(), mxid_to_string(), op_signature_string(), out_gistxlogPageSplit(), out_gistxlogPageUpdate(), out_infobits(), out_member(), out_target(), parseTypeString(), pg_get_constraintdef_worker(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_ruledef_worker(), pg_get_triggerdef_worker(), pg_get_viewdef_worker(), PLy_traceback(), postgres_fdw_validator(), postgresAcquireSampleRowsFunc(), postgresGetForeignPlan(), postgresql_fdw_validator(), pretty_format_node_dump(), print_function_arguments(), processIndirection(), ProcSleep(), query_to_xml_internal(), quote_object_name(), quote_qualified_identifier(), relmap_desc(), report_triggers(), reportDependentObjects(), ri_add_cast_to(), ri_Check_Pk_Match(), RI_FKey_cascade_del(), RI_FKey_cascade_upd(), RI_FKey_check(), RI_FKey_setdefault_del(), RI_FKey_setdefault_upd(), RI_FKey_setnull_del(), RI_FKey_setnull_upd(), ri_GenerateQual(), ri_GenerateQualCollation(), RI_Initial_Check(), ri_restrict_del(), ri_restrict_upd(), schema_get_xml_visible_tables(), schema_to_xml_internal(), send_message_to_frontend(), send_message_to_server_log(), sepgsql_attribute_post_create(), sepgsql_audit_log(), sepgsql_database_post_create(), sepgsql_proc_post_create(), sepgsql_relation_post_create(), sepgsql_schema_post_create(), seq_desc(), serialize_deflist(), show_hash_info(), show_sort_info(), ShowTransactionStateRec(), ShowUsage(), smgr_desc(), spg_desc(), SPI_sql_row_to_xmlelement(), standby_desc(), standby_desc_running_xacts(), StartupXLOG(), storeObjectDescription(), table_to_xml_internal(), tblspc_desc(), txid_snapshot_out(), worker_spi_main(), write_csvlog(), xact_desc(), xact_desc_abort(), xact_desc_assignment(), xact_desc_commit(), xact_desc_commit_compact(), xlog_desc(), XLogInsert(), xmlcomment(), xmldata_root_element_end(), xmldata_root_element_start(), xmlpi(), xpath_table(), and xsd_schema_element_start().
{ va_list args; va_start(args, fmt); vprintf(fmt, args); va_end(args); }
void appendStringInfoChar | ( | StringInfo | str, | |
char | ch | |||
) |
Definition at line 96 of file compat.c.
Referenced by _outBitmapset(), _outList(), _outNode(), _outToken(), _outValue(), appendContextKeyword(), appendStringInfoRegexpSubstr(), appendTypeNameToBuffer(), appendWhereClause(), array_dim_to_json(), BuildIndexValueDescription(), composite_to_json(), ConvertTriggerToFK(), cube_out(), database_to_xml_internal(), DeadLockReport(), deparseArrayExpr(), deparseArrayRef(), deparseBoolExpr(), deparseDistinctExpr(), deparseFuncExpr(), deparseNullTest(), deparseOpExpr(), deparseScalarArrayOpExpr(), deparseStringLiteral(), escape_param_str(), exec_stmt_raise(), ExecBuildSlotValueDescription(), ExplainBeginOutput(), ExplainCloseGroup(), ExplainJSONLineEnding(), ExplainNode(), ExplainOpenGroup(), ExplainProperty(), ExplainPropertyList(), ExplainSeparatePlans(), ExplainYAMLLineStarting(), format_procedure_internal(), funcname_signature_string(), generate_operator_name(), get_agg_expr(), get_basic_select_query(), get_coercion_expr(), get_column_alias_list(), get_delete_query_def(), get_from_clause_coldeflist(), get_from_clause_item(), get_func_expr(), get_insert_query_def(), get_oper_expr(), get_parameter(), get_rule_expr(), get_rule_expr_paren(), get_rule_windowspec(), get_setop_query(), get_sublink_expr(), get_update_query_def(), get_values_def(), get_variable(), get_windowfunc_expr(), get_with_clause(), heap_desc(), incompatible_module_error(), InteractiveBackend(), json_agg_finalfn(), json_agg_transfn(), json_lex_string(), log_line_prefix(), mxid_to_string(), NameListToQuotedString(), NameListToString(), pg_get_functiondef(), pg_get_indexdef_worker(), pq_send_ascii_string(), printSubscripts(), range_bound_escape(), range_deparse(), range_parse_bound(), record_in(), record_out(), reportDependentObjects(), schema_to_xml_internal(), send_message_to_frontend(), send_message_to_server_log(), sepgsql_proc_post_create(), serialize_deflist(), simple_quote_literal(), SPI_sql_row_to_xmlelement(), storeObjectDescription(), txid_snapshot_out(), TypeNameListToString(), uuid_out(), write_csvlog(), and xmlpi().
{ appendStringInfo(str, "%c", ch); }
void appendStringInfoString | ( | StringInfo | str, | |
const char * | string | |||
) |
Definition at line 90 of file compat.c.
Referenced by _outValue(), appendContextKeyword(), appendTypeNameToBuffer(), appendWhereClause(), array_dim_to_json(), array_to_json_internal(), array_to_text_internal(), BuildIndexValueDescription(), composite_to_json(), concat_internal(), config_enum_get_options(), ConvertTriggerToFK(), database_to_xml_internal(), database_to_xmlschema_internal(), datum_to_json(), DeadLockReport(), decompile_column_index_array(), deparseAnalyzeSql(), deparseArrayExpr(), deparseBoolExpr(), deparseColumnRef(), deparseConst(), deparseDeleteSql(), deparseDistinctExpr(), deparseFuncExpr(), deparseInsertSql(), deparseNullTest(), deparseReturningList(), deparseSelectSql(), deparseTargetList(), deparseUpdateSql(), errdetail_params(), escape_json(), escape_xml(), estimate_path_cost_size(), exec_stmt_raise(), ExecBuildSlotValueDescription(), execute_extension_script(), ExplainBeginOutput(), ExplainDummyGroup(), ExplainEndOutput(), ExplainIndexScanDetails(), ExplainNode(), ExplainOneUtility(), ExplainOpenGroup(), ExplainProperty(), ExplainPropertyList(), ExplainQuery(), ExplainTargetRel(), ExplainXMLTag(), ExportSnapshot(), flatten_set_variable_args(), format_procedure_internal(), funcname_signature_string(), generate_operator_name(), get_agg_expr(), get_basic_select_query(), get_column_alias_list(), get_const_expr(), get_from_clause(), get_from_clause_item(), get_func_expr(), get_insert_query_def(), get_rule_expr(), get_rule_orderby(), get_rule_windowclause(), get_rule_windowspec(), get_sql_delete(), get_sql_insert(), get_sql_update(), get_sublink_expr(), get_target_list(), get_tuple_of_interest(), get_update_query_def(), get_utility_query_def(), get_values_def(), get_variable(), get_windowfunc_expr(), get_with_clause(), getConstraintTypeDescription(), getObjectIdentity(), hstore_to_json(), hstore_to_json_loose(), json_agg_transfn(), json_lex_string(), log_line_prefix(), make_ruledef(), map_sql_catalog_to_xmlschema_types(), map_sql_schema_to_xmlschema_types(), map_sql_table_to_xmlschema(), map_sql_type_to_xml_name(), map_sql_value_to_xml_value(), map_xml_name_to_sql_identifier(), NameListToQuotedString(), NameListToString(), op_signature_string(), out_member(), pg_extension_update_paths(), pg_get_constraintdef_worker(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_triggerdef_worker(), PLy_traceback(), print_function_arguments(), print_function_rettype(), query_to_xml_internal(), quote_qualified_identifier(), range_deparse(), report_triggers(), RI_FKey_cascade_upd(), RI_FKey_setdefault_del(), RI_FKey_setdefault_upd(), RI_FKey_setnull_del(), RI_FKey_setnull_upd(), ri_GenerateQual(), ri_ReportViolation(), schema_to_xml_internal(), schema_to_xmlschema_internal(), send_message_to_frontend(), send_message_to_server_log(), sepgsql_proc_post_create(), SPI_sql_row_to_xmlelement(), text_format_append_string(), write_csvlog(), xact_desc_abort(), xact_desc_commit(), xact_desc_commit_compact(), xml_out_internal(), xmlconcat(), xmldata_root_element_start(), xmlpi(), xmlroot(), xsd_schema_element_end(), and xsd_schema_element_start().
{ appendStringInfo(str, "%s", string); }
const char* timestamptz_to_str | ( | TimestampTz | dt | ) |
Definition at line 55 of file compat.c.
Referenced by backend_read_statsfile(), CreateRestartPoint(), pgstat_recv_inquiry(), ProcessWalSndrMessage(), readRecoveryCommandFile(), recoveryStopsHere(), StartupXLOG(), xact_desc_abort(), xact_desc_commit(), xact_desc_commit_compact(), and xlog_desc().
{ static char buf[MAXDATELEN + 1]; char ts[MAXDATELEN + 1]; char zone[MAXDATELEN + 1]; time_t result = (time_t) timestamptz_to_time_t(dt); struct tm *ltime = localtime(&result); strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S", ltime); strftime(zone, sizeof(zone), "%Z", ltime); #ifdef HAVE_INT64_TIMESTAMP sprintf(buf, "%s.%06d %s", ts, (int) (dt % USECS_PER_SEC), zone); #else sprintf(buf, "%s.%.6f %s", ts, fabs(dt - floor(dt)), zone); #endif return buf; }
pg_time_t timestamptz_to_time_t | ( | TimestampTz | t | ) |
Definition at line 28 of file compat.c.
Referenced by BackendInitialize(), and timestamptz_to_str().
{ pg_time_t result; #ifdef HAVE_INT64_TIMESTAMP result = (pg_time_t) (t / USECS_PER_SEC + ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY)); #else result = (pg_time_t) (t + ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY)); #endif return result; }