PostgreSQL Source Code  git master
pqexpbuffer.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PQExpBufferData
 

Macros

#define PQExpBufferBroken(str)    ((str) == NULL || (str)->maxlen == 0)
 
#define PQExpBufferDataBroken(buf)    ((buf).maxlen == 0)
 
#define INITIAL_EXPBUFFER_SIZE   256
 

Typedefs

typedef struct PQExpBufferData PQExpBufferData
 
typedef PQExpBufferDataPQExpBuffer
 

Functions

PQExpBuffer createPQExpBuffer (void)
 
void initPQExpBuffer (PQExpBuffer str)
 
void destroyPQExpBuffer (PQExpBuffer str)
 
void termPQExpBuffer (PQExpBuffer str)
 
void resetPQExpBuffer (PQExpBuffer str)
 
int enlargePQExpBuffer (PQExpBuffer str, size_t needed)
 
void printfPQExpBuffer (PQExpBuffer str, const char *fmt,...) pg_attribute_printf(2
 
void void appendPQExpBuffer (PQExpBuffer str, const char *fmt,...) pg_attribute_printf(2
 
void void bool appendPQExpBufferVA (PQExpBuffer str, const char *fmt, va_list args) pg_attribute_printf(2
 
void void bool void appendPQExpBufferStr (PQExpBuffer str, const char *data)
 
void appendPQExpBufferChar (PQExpBuffer str, char ch)
 
void appendBinaryPQExpBuffer (PQExpBuffer str, const char *data, size_t datalen)
 

Macro Definition Documentation

◆ INITIAL_EXPBUFFER_SIZE

#define INITIAL_EXPBUFFER_SIZE   256

Definition at line 76 of file pqexpbuffer.h.

◆ PQExpBufferBroken

#define PQExpBufferBroken (   str)     ((str) == NULL || (str)->maxlen == 0)

Definition at line 59 of file pqexpbuffer.h.

◆ PQExpBufferDataBroken

#define PQExpBufferDataBroken (   buf)     ((buf).maxlen == 0)

Definition at line 67 of file pqexpbuffer.h.

Typedef Documentation

◆ PQExpBuffer

Definition at line 51 of file pqexpbuffer.h.

◆ PQExpBufferData

Function Documentation

◆ appendBinaryPQExpBuffer()

void appendBinaryPQExpBuffer ( PQExpBuffer  str,
const char *  data,
size_t  datalen 
)

Definition at line 397 of file pqexpbuffer.c.

398 {
399  /* Make more room if needed */
400  if (!enlargePQExpBuffer(str, datalen))
401  return;
402 
403  /* OK, append the data */
404  memcpy(str->data + str->len, data, datalen);
405  str->len += datalen;
406 
407  /*
408  * Keep a trailing null in place, even though it's probably useless for
409  * binary data...
410  */
411  str->data[str->len] = '\0';
412 }
const char * str
const void * data
int enlargePQExpBuffer(PQExpBuffer str, size_t needed)
Definition: pqexpbuffer.c:172

References data, enlargePQExpBuffer(), and str.

Referenced by appendPQExpBufferStr(), createViewAsClause(), dumpTableSchema(), pg_GSS_error_int(), and pqGets_internal().

◆ appendPQExpBuffer()

void void appendPQExpBuffer ( PQExpBuffer  str,
const char *  fmt,
  ... 
)

◆ appendPQExpBufferChar()

void appendPQExpBufferChar ( PQExpBuffer  str,
char  ch 
)

Definition at line 378 of file pqexpbuffer.c.

379 {
380  /* Make more room if needed */
381  if (!enlargePQExpBuffer(str, 1))
382  return;
383 
384  /* OK, append the character */
385  str->data[str->len] = ch;
386  str->len++;
387  str->data[str->len] = '\0';
388 }

References enlargePQExpBuffer(), and str.

Referenced by _doSetSessionAuth(), AddAcl(), append_db_pattern_cte(), append_rel_pattern_raw_cte(), appendConnStrItem(), appendConnStrVal(), appendPGArray(), AppendPlainCommandOption(), appendPsqlMetaConnect(), appendShellStringNoError(), appendStringLiteralConn(), appendStringLiteralDQ(), binary_upgrade_set_pg_class_oids(), build_client_first_message(), cluster_conn_opts(), cluster_one_database(), conninfo_uri_parse_options(), constructConnStr(), createDummyViewAsClause(), createPartitions(), CreateReplicationSlot(), dequoteAclUserName(), describeOneTableDetails(), describeRoles(), do_edit(), dumpCompositeType(), dumpConstraint(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpPublication(), dumpRule(), dumpTableData_insert(), dumpTableSchema(), dumpUserConfig(), ExecuteSimpleCommands(), fmtCopyColumnList(), fmtId(), format_aggregate_signature(), format_function_signature(), gather_boolean_expression(), GenerateRecoveryConfig(), get_create_object_cmd(), getAggregates(), getConstraints(), getFuncs(), getIndexes(), getNamespaces(), getPolicies(), getTableAttrs(), getTriggers(), indent_lines(), libpq_append_conn_error(), libpq_append_error(), main(), MainLoop(), minimal_error_message(), output_completion_banner(), patternToSQLRegex(), pg_append_history(), pg_GSS_error(), pg_GSS_error_int(), pq_verify_peer_name_matches_certificate(), pqBuildErrorMessage3(), PQconnectPoll(), pqGetNegotiateProtocolVersion3(), prepare_vacuum_command(), processSQLNamePattern(), quoteAclUserName(), read_pattern(), read_quoted_string(), replace_guc_value(), reportErrorPosition(), run_reindex_command(), start_standby_server(), and StreamLogicalLog().

◆ appendPQExpBufferStr()

void void bool void appendPQExpBufferStr ( PQExpBuffer  str,
const char *  data 
)

Definition at line 367 of file pqexpbuffer.c.

368 {
370 }
void appendBinaryPQExpBuffer(PQExpBuffer str, const char *data, size_t datalen)
Definition: pqexpbuffer.c:397

References appendBinaryPQExpBuffer(), data, and str.

Referenced by _doSetSessionAuth(), _getObjectDescription(), _printTableAccessMethodNoStorage(), _selectOutputSchema(), _selectTablespace(), add_role_attribute(), AddAcl(), append_db_pattern_cte(), append_rel_pattern_filtered_cte(), append_rel_pattern_raw_cte(), appendConnStrItem(), appendConnStrVal(), appendPGArray(), AppendPlainCommandOption(), appendPsqlMetaConnect(), appendQualifiedRelation(), appendReloptionsArray(), appendShellStringNoError(), appendStringLiteralDQ(), binary_upgrade_extension_member(), binary_upgrade_set_pg_class_oids(), binary_upgrade_set_type_oids_by_type_oid(), build_client_final_message(), build_client_first_message(), buildACLCommands(), buildMatViewRefreshDependencies(), check_for_incompatible_polymorphics(), cluster_conn_opts(), cluster_one_database(), collectComments(), collectSecLabels(), compile_database_list(), compile_relation_list_one_db(), concat_conninfo_dbname(), conninfo_uri_parse_options(), copy_previous_query(), create_sql_command(), createDummyViewAsClause(), createPartitions(), CreateReplicationSlot(), describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describeFunctions(), describeOneTableDetails(), describeOperators(), describePublications(), DescribeQuery(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), do_copy(), do_edit(), dumpAccessMethod(), dumpACL(), dumpAgg(), dumpBaseType(), dumpCast(), dumpCollation(), dumpCommentExtended(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpDatabase(), dumpDomain(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationTable(), dumpRangeType(), dumpRoleMembership(), dumpRoles(), dumpRule(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpSubscription(), dumpSubscriptionTable(), dumpTable(), dumpTableAttach(), dumpTableComment(), dumpTableData_copy(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpUserMappings(), emitShSecLabels(), ensureCleanShutdown(), exec_command_ef_ev(), expand_dbname_patterns(), expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), fmtCopyColumnList(), fmtId(), fmtQualifiedId(), format_aggregate_signature(), format_function_arguments(), format_function_signature(), gather_boolean_expression(), generate_old_dump(), GenerateRecoveryConfig(), get_create_object_cmd(), get_db_conn(), get_parallel_object_list(), get_rel_infos_query(), getAccessMethods(), getAdditionalACLs(), getAggregates(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDependencies(), getDomainConstraints(), getEventTriggers(), getExtendedStatistics(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFuncs(), getIndexes(), getInherits(), getLOs(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPartitioningInfo(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRestoreCommand(), getRules(), gets_fromFile(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), indent_lines(), initCreatePKeys(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtendedStats(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listLargeObjects(), listOperatorClasses(), listOperatorFamilies(), listOpFamilyFunctions(), listOpFamilyOperators(), listPartitionedTables(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), lookup_object_oid(), main(), makeAlterConfigCommand(), minimal_error_message(), objectDescription(), output_completion_banner(), patternToSQLRegex(), permissionsList(), pg_append_history(), pg_fe_sendauth(), pg_GSS_write(), pg_SASL_init(), pgtls_read(), pgtls_write(), pqBuildErrorMessage3(), pqCheckInBufferSpace(), pqCheckOutBufferSpace(), pqConnectDBStart(), pqGetErrorNotice3(), pqGetNegotiateProtocolVersion3(), pqPipelineSyncInternal(), pqSaveWriteError(), prepare_vacuum_command(), printVerboseErrorMessages(), processSQLNamePattern(), read_pattern(), replace_guc_value(), reportErrorPosition(), RestoreArchive(), run_reindex_command(), runInitSteps(), runPgDump(), setup_connection(), start_conn(), start_postmaster(), start_standby_server(), StreamLogicalLog(), and vacuum_one_database().

◆ appendPQExpBufferVA()

void void bool appendPQExpBufferVA ( PQExpBuffer  str,
const char *  fmt,
va_list  args 
)

◆ createPQExpBuffer()

PQExpBuffer createPQExpBuffer ( void  )

Definition at line 72 of file pqexpbuffer.c.

73 {
75 
77  if (res != NULL)
79 
80  return res;
81 }
#define malloc(a)
Definition: header.h:50
void initPQExpBuffer(PQExpBuffer str)
Definition: pqexpbuffer.c:90
PQExpBufferData * PQExpBuffer
Definition: pqexpbuffer.h:51

References initPQExpBuffer(), malloc, and res.

Referenced by _doSetSessionAuth(), _printTableAccessMethodNoStorage(), _selectOutputSchema(), _selectTableAccessMethod(), _selectTablespace(), _WriteLOData(), append_depends_on_extension(), appendStringLiteralDQ(), binary_upgrade_set_type_oids_by_type_oid(), buildACLCommands(), buildDefaultACLCommands(), buildMatViewRefreshDependencies(), buildShSecLabels(), check_and_drop_existing_subscriptions(), cluster_conn_opts(), collectComments(), collectSecLabels(), concat_conninfo_dbname(), constructConnStr(), create_logical_replication_slot(), create_logical_replication_slots(), create_publication(), create_subscription(), createDummyViewAsClause(), CreateReplicationSlot(), createViewAsClause(), drop_existing_subscriptions(), drop_publication(), drop_replication_slot(), DropReplicationSlot(), dropRoles(), dump_lo_buf(), dumpAccessMethod(), dumpACL(), dumpAgg(), dumpAttrDef(), dumpBaseType(), dumpCast(), dumpCollation(), dumpCommentExtended(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpDatabase(), dumpDatabaseConfig(), dumpDefaultACL(), dumpDomain(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpIndex(), dumpIndexAttach(), dumpLO(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationNamespace(), dumpPublicationTable(), dumpRangeType(), dumpRoleGUCPrivs(), dumpRoleMembership(), dumpRoles(), dumpRule(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpShellType(), dumpStatisticsExt(), dumpStdStrings(), dumpSubscription(), dumpSubscriptionTable(), dumpTable(), dumpTableAttach(), dumpTableComment(), dumpTableConstraintComment(), dumpTableData(), dumpTableData_copy(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpTSParser(), dumpTSTemplate(), dumpUndefinedType(), dumpUserConfig(), dumpUserMappings(), enable_subscription(), ensureCleanShutdown(), exec_command_sf_sv(), ExecuteSimpleCommands(), expand_dbname_patterns(), expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), fmtQualifiedId(), gather_boolean_expression(), GenerateRecoveryConfig(), get_base_conninfo(), get_create_object_cmd(), get_language_name(), get_sub_conninfo(), getAccessMethods(), getAdditionalACLs(), getAggregates(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDependencies(), getDomainConstraints(), getEventTriggers(), getExtendedStatistics(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFormattedTypeName(), getFuncs(), getIndexes(), getInherits(), getLOs(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPartitioningInfo(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRestoreCommand(), getRules(), gets_fromFile(), GetSlotInformation(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), is_load_via_partition_root(), lockTableForWorker(), lookup_object_oid(), main(), MainLoop(), minimal_error_message(), printVerboseErrorMessages(), process_data_type_check(), processExtensionTables(), ReceiveArchiveStreamChunk(), refreshMatViewData(), replace_guc_value(), RestoreArchive(), set_replication_progress(), set_restrict_relation_kind(), setup_connection(), start_standby_server(), StreamLogicalLog(), and upgrade_task_create().

◆ destroyPQExpBuffer()

void destroyPQExpBuffer ( PQExpBuffer  str)

Definition at line 114 of file pqexpbuffer.c.

115 {
116  if (str)
117  {
119  free(str);
120  }
121 }
#define free(a)
Definition: header.h:65
void termPQExpBuffer(PQExpBuffer str)
Definition: pqexpbuffer.c:129

References free, str, and termPQExpBuffer().

Referenced by _doSetSessionAuth(), _printTableAccessMethodNoStorage(), _selectOutputSchema(), _selectTableAccessMethod(), _selectTablespace(), _WriteLOData(), append_depends_on_extension(), appendStringLiteralDQ(), BaseBackup(), binary_upgrade_set_type_oids_by_type_oid(), buildACLCommands(), buildDefaultACLCommands(), buildMatViewRefreshDependencies(), buildShSecLabels(), check_and_drop_existing_subscriptions(), check_for_data_types_usage(), collectComments(), collectSecLabels(), concat_conninfo_dbname(), constructConnStr(), create_logical_replication_slot(), create_logical_replication_slots(), create_publication(), create_subscription(), CreateReplicationSlot(), createViewAsClause(), DeCloneArchive(), drop_existing_subscriptions(), drop_publication(), drop_replication_slot(), DropReplicationSlot(), dropRoles(), dump_lo_buf(), dumpAccessMethod(), dumpACL(), dumpAgg(), dumpAttrDef(), dumpBaseType(), dumpCast(), dumpCollation(), dumpCommentExtended(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpDatabase(), dumpDatabaseConfig(), dumpDefaultACL(), dumpDomain(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpIndex(), dumpIndexAttach(), dumpLO(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationNamespace(), dumpPublicationTable(), dumpRangeType(), dumpRoleGUCPrivs(), dumpRoleMembership(), dumpRoles(), dumpRule(), dumpSearchPath(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpShellType(), dumpStatisticsExt(), dumpStdStrings(), dumpSubscription(), dumpSubscriptionTable(), dumpTable(), dumpTableAttach(), dumpTableComment(), dumpTableConstraintComment(), dumpTableData(), dumpTableData_copy(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpTSParser(), dumpTSTemplate(), dumpUndefinedType(), dumpUserConfig(), dumpUserMappings(), enable_subscription(), ensureCleanShutdown(), exec_command_sf_sv(), expand_dbname_patterns(), expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), fmtQualifiedId(), get_base_conninfo(), get_create_object_cmd(), get_language_name(), get_sub_conninfo(), getAccessMethods(), getAdditionalACLs(), getAggregates(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDependencies(), getDomainConstraints(), getEventTriggers(), getExtendedStatistics(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFormattedTypeName(), getFuncs(), getIndexes(), getInherits(), getLOs(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPartitioningInfo(), getPolicies(), getProcLangs(), getPublicationNamespaces(), getPublications(), getPublicationTables(), getRestoreCommand(), getRules(), GetSlotInformation(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), ignore_boolean_expression(), is_load_via_partition_root(), is_true_boolean_expression(), lockTableForWorker(), lookup_object_oid(), main(), MainLoop(), minimal_error_message(), processExtensionTables(), ReceiveArchiveStream(), refreshMatViewData(), RestoreArchive(), set_replication_progress(), set_restrict_relation_kind(), setup_connection(), start_standby_server(), StreamLogicalLog(), and upgrade_task_free().

◆ enlargePQExpBuffer()

int enlargePQExpBuffer ( PQExpBuffer  str,
size_t  needed 
)

Definition at line 172 of file pqexpbuffer.c.

173 {
174  size_t newlen;
175  char *newdata;
176 
177  if (PQExpBufferBroken(str))
178  return 0; /* already failed */
179 
180  /*
181  * Guard against ridiculous "needed" values, which can occur if we're fed
182  * bogus data. Without this, we can get an overflow or infinite loop in
183  * the following.
184  */
185  if (needed >= ((size_t) INT_MAX - str->len))
186  {
188  return 0;
189  }
190 
191  needed += str->len + 1; /* total space required now */
192 
193  /* Because of the above test, we now have needed <= INT_MAX */
194 
195  if (needed <= str->maxlen)
196  return 1; /* got enough space already */
197 
198  /*
199  * We don't want to allocate just a little more space with each append;
200  * for efficiency, double the buffer size each time it overflows.
201  * Actually, we might need to more than double it if 'needed' is big...
202  */
203  newlen = (str->maxlen > 0) ? (2 * str->maxlen) : 64;
204  while (needed > newlen)
205  newlen = 2 * newlen;
206 
207  /*
208  * Clamp to INT_MAX in case we went past it. Note we are assuming here
209  * that INT_MAX <= UINT_MAX/2, else the above loop could overflow. We
210  * will still have newlen >= needed.
211  */
212  if (newlen > (size_t) INT_MAX)
213  newlen = (size_t) INT_MAX;
214 
215  newdata = (char *) realloc(str->data, newlen);
216  if (newdata != NULL)
217  {
218  str->data = newdata;
219  str->maxlen = newlen;
220  return 1;
221  }
222 
224  return 0;
225 }
#define realloc(a, b)
Definition: header.h:60
static void markPQExpBufferBroken(PQExpBuffer str)
Definition: pqexpbuffer.c:50
#define PQExpBufferBroken(str)
Definition: pqexpbuffer.h:59

References markPQExpBufferBroken(), PQExpBufferBroken, realloc, and str.

Referenced by appendBinaryPQExpBuffer(), appendByteaLiteral(), appendPQExpBufferChar(), appendPQExpBufferVA(), appendStringLiteral(), appendStringLiteralConn(), build_client_final_message(), and passwordFromFile().

◆ initPQExpBuffer()

void initPQExpBuffer ( PQExpBuffer  str)

Definition at line 90 of file pqexpbuffer.c.

91 {
92  str->data = (char *) malloc(INITIAL_EXPBUFFER_SIZE);
93  if (str->data == NULL)
94  {
95  str->data = unconstify(char *, oom_buffer_ptr); /* see comment above */
96  str->maxlen = 0;
97  str->len = 0;
98  }
99  else
100  {
101  str->maxlen = INITIAL_EXPBUFFER_SIZE;
102  str->len = 0;
103  str->data[0] = '\0';
104  }
105 }
#define unconstify(underlying_type, expr)
Definition: c.h:1224
static const char *const oom_buffer_ptr
Definition: pqexpbuffer.c:41
#define INITIAL_EXPBUFFER_SIZE
Definition: pqexpbuffer.h:76

References INITIAL_EXPBUFFER_SIZE, malloc, oom_buffer_ptr, str, and unconstify.

Referenced by _printTocEntry(), _reconnectToDB(), add_tablespace_footer(), append_database_pattern(), append_relation_pattern_helper(), append_schema_pattern(), appendPsqlMetaConnect(), appendQualifiedRelation(), BaseBackup(), bootstrap_template1(), build_client_final_message(), build_client_first_message(), check_for_incompatible_polymorphics(), cluster_one_database(), compile_database_list(), compile_relation_list_one_db(), conninfo_uri_parse_options(), create_sql_command(), createPartitions(), createPQExpBuffer(), describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describeFunctions(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), DescribeQuery(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), do_copy(), exec_command_password(), executeMetaCommand(), expand_schema_name_patterns(), expand_table_name_patterns(), filter_read_item(), format_aggregate_signature(), format_function_arguments(), format_function_signature(), generate_old_dump(), GenerateRecoveryConfig(), get_db_conn(), get_parallel_object_list(), get_rel_infos_query(), getCasts(), getParameterStatus(), getTransforms(), indent_lines(), initCreatePKeys(), initCreateTables(), initGenerateDataServerSide(), initialize_data_directory(), initPopulateTable(), libpqrcv_get_conninfo(), 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(), main(), objectDescription(), old_9_6_invalidate_hash_indexes(), output_completion_banner(), ParseScript(), passwordFromFile(), patternToSQLRegex(), permissionsList(), pg_SASL_init(), PQchangePassword(), PQconndefaults(), PQconninfo(), PQconninfoParse(), pqGetErrorNotice3(), pqGetNegotiateProtocolVersion3(), pqMakeEmptyPGconn(), PQresultVerboseErrorMessage(), process_backslash_command(), process_extension_updates(), processSQLNamePattern(), psql_get_variable(), ReceiveTarFile(), resetPQExpBuffer(), run_reindex_command(), runInitSteps(), runPgDump(), slashUsage(), start_conn(), start_postmaster(), syntax_error(), test_specific_config_settings(), usage(), vacuum_one_database(), and validateSQLNamePattern().

◆ printfPQExpBuffer()

void printfPQExpBuffer ( PQExpBuffer  str,
const char *  fmt,
  ... 
)

◆ resetPQExpBuffer()

void resetPQExpBuffer ( PQExpBuffer  str)

Definition at line 146 of file pqexpbuffer.c.

147 {
148  if (str)
149  {
150  if (str->data != oom_buffer)
151  {
152  str->len = 0;
153  str->data[0] = '\0';
154  }
155  else
156  {
157  /* try to reinitialize to valid state */
159  }
160  }
161 }
static const char oom_buffer[1]
Definition: pqexpbuffer.c:38

References initPQExpBuffer(), oom_buffer, and str.

Referenced by cluster_conn_opts(), create_logical_replication_slots(), create_publication(), dequoteAclUserName(), describeOneTableDetails(), describeRoles(), do_edit(), dumpCompositeTypeColComments(), dumpDatabase(), dumpOpclass(), dumpOpfamily(), dumpRoleMembership(), dumpRoles(), dumpSequence(), dumpSequenceData(), dumpTableComment(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTrigger(), dumpTSConfig(), dumpUserConfig(), dumpUserMappings(), exec_command_edit(), exec_command_ef_ev(), exec_command_reset(), exec_command_watch(), ExecuteSimpleCommands(), expand_dbname_patterns(), expand_extension_name_patterns(), expand_foreign_server_name_patterns(), expand_schema_name_patterns(), expand_table_name_patterns(), get_create_object_cmd(), get_parallel_object_list(), getNamespaces(), gets_fromFile(), getTableAttrs(), getTables(), initCreatePKeys(), MainLoop(), parseAclItem(), ParseScript(), pg_send_history(), PQcancelPoll(), pqGetErrorNotice3(), pqGets_internal(), prepare_btree_command(), prepare_heap_command(), prepare_vacuum_command(), printfPQExpBuffer(), printVerboseErrorMessages(), set_replication_progress(), StreamLogicalLog(), and vacuum_one_database().

◆ termPQExpBuffer()

void termPQExpBuffer ( PQExpBuffer  str)

Definition at line 129 of file pqexpbuffer.c.

130 {
131  if (str->data != oom_buffer)
132  free(str->data);
133  /* just for luck, make the buffer validly empty. */
134  str->data = unconstify(char *, oom_buffer_ptr); /* see comment above */
135  str->maxlen = 0;
136  str->len = 0;
137 }

References free, oom_buffer, oom_buffer_ptr, str, and unconstify.

Referenced by _printTocEntry(), _reconnectToDB(), add_tablespace_footer(), append_database_pattern(), append_relation_pattern_helper(), append_schema_pattern(), appendPsqlMetaConnect(), appendQualifiedRelation(), bootstrap_template1(), build_client_final_message(), build_client_first_message(), check_for_incompatible_polymorphics(), cluster_one_database(), compile_database_list(), compile_relation_list_one_db(), conninfo_uri_parse_options(), createPartitions(), describeAccessMethods(), describeAggregates(), describeConfigurationParameters(), describeFunctions(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), DescribeQuery(), describeRoleGrants(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), destroyPQExpBuffer(), do_copy(), exec_command_password(), executeMetaCommand(), expand_schema_name_patterns(), expand_table_name_patterns(), free_command(), freePGconn(), generate_old_dump(), GenerateRecoveryConfig(), get_db_conn(), get_parallel_object_list(), getParameterStatus(), indent_lines(), initCreatePKeys(), initCreateTables(), initGenerateDataServerSide(), initialize_data_directory(), initPopulateTable(), libpqrcv_get_conninfo(), 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(), main(), objectDescription(), old_9_6_invalidate_hash_indexes(), output_completion_banner(), ParseScript(), passwordFromFile(), patternToSQLRegex(), permissionsList(), pg_SASL_init(), PQchangePassword(), PQconndefaults(), PQconninfo(), PQconninfoParse(), pqGetErrorNotice3(), pqGetNegotiateProtocolVersion3(), PQresultVerboseErrorMessage(), process_backslash_command(), process_extension_updates(), processSQLNamePattern(), ReceiveTarFile(), run_reindex_command(), runInitSteps(), runPgDump(), slashUsage(), start_conn(), start_postmaster(), syntax_error(), test_specific_config_settings(), usage(), vacuum_one_database(), and validateSQLNamePattern().