PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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 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

#define INITIAL_EXPBUFFER_SIZE   256

Definition at line 76 of file pqexpbuffer.h.

Referenced by initPQExpBuffer().

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

Typedef Documentation

Definition at line 51 of file pqexpbuffer.h.

Function Documentation

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

Definition at line 415 of file pqexpbuffer.c.

References PQExpBufferData::data, enlargePQExpBuffer(), and PQExpBufferData::len.

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

416 {
417  /* Make more room if needed */
418  if (!enlargePQExpBuffer(str, datalen))
419  return;
420 
421  /* OK, append the data */
422  memcpy(str->data + str->len, data, datalen);
423  str->len += datalen;
424 
425  /*
426  * Keep a trailing null in place, even though it's probably useless for
427  * binary data...
428  */
429  str->data[str->len] = '\0';
430 }
int enlargePQExpBuffer(PQExpBuffer str, size_t needed)
Definition: pqexpbuffer.c:171
void void appendPQExpBuffer ( PQExpBuffer  str,
const char *  fmt,
  ... 
)
void appendPQExpBufferChar ( PQExpBuffer  str,
char  ch 
)

Definition at line 396 of file pqexpbuffer.c.

References PQExpBufferData::data, enlargePQExpBuffer(), and PQExpBufferData::len.

Referenced by _doSetSessionAuth(), AddAcl(), appendConnStrVal(), appendPsqlMetaConnect(), appendShellStringNoError(), appendStringLiteralConn(), appendStringLiteralDQ(), binary_upgrade_set_pg_class_oids(), cluster_conn_opts(), cluster_one_database(), conninfo_uri_parse_options(), constructConnStr(), copyAclUserName(), create_script_for_cluster_analyze(), createDummyViewAsClause(), describeOneTableDetails(), describeRoles(), do_edit(), dumpCompositeType(), dumpConstraint(), dumpDatabaseConfig(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpRule(), dumpTableData_insert(), dumpTableSchema(), dumpUserConfig(), ExecuteSimpleCommands(), fmtCopyColumnList(), fmtId(), format_aggregate_signature(), format_function_arguments_old(), format_function_signature(), gather_boolean_expression(), GenerateRecoveryConf(), get_create_object_cmd(), getAggregates(), getFuncs(), main(), MainLoop(), minimal_error_message(), pg_append_history(), pqBuildErrorMessage3(), PQconnectPoll(), prepare_vacuum_command(), processSQLNamePattern(), reindex_one_database(), reportErrorPosition(), and StreamLogicalLog().

397 {
398  /* Make more room if needed */
399  if (!enlargePQExpBuffer(str, 1))
400  return;
401 
402  /* OK, append the character */
403  str->data[str->len] = ch;
404  str->len++;
405  str->data[str->len] = '\0';
406 }
int enlargePQExpBuffer(PQExpBuffer str, size_t needed)
Definition: pqexpbuffer.c:171
void void void appendPQExpBufferStr ( PQExpBuffer  str,
const char *  data 
)

Definition at line 385 of file pqexpbuffer.c.

References appendBinaryPQExpBuffer().

Referenced by _doSetSessionAuth(), _getObjectDescription(), _printTocEntry(), _selectOutputSchema(), _selectTablespace(), add_role_attribute(), AddAcl(), appendConnStrVal(), appendPsqlMetaConnect(), appendReloptionsArray(), appendShellStringNoError(), appendStringLiteralDQ(), binary_upgrade_extension_member(), binary_upgrade_set_pg_class_oids(), binary_upgrade_set_type_oids_by_rel_oid(), binary_upgrade_set_type_oids_by_type_oid(), buildACLCommands(), buildMatViewRefreshDependencies(), cluster_conn_opts(), cluster_one_database(), collectComments(), collectSecLabels(), conninfo_uri_parse_options(), copy_previous_query(), create_script_for_cluster_analyze(), createDummyViewAsClause(), describeAccessMethods(), describeAggregates(), describeFunctions(), describeOneTableDetails(), describeOperators(), describePublications(), DescribeQuery(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), do_copy(), do_edit(), dumpAgg(), dumpBaseType(), dumpCast(), dumpCollation(), dumpComment(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpCreateDB(), dumpDatabase(), dumpDomain(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpProcLang(), dumpPublication(), dumpRangeType(), dumpRoles(), dumpRule(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpSubscription(), dumpTableComment(), dumpTableData_copy(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpUserMappings(), emitShSecLabels(), exec_command_ef_ev(), findLastBuiltinOid_V71(), fmtCopyColumnList(), fmtId(), fmtQualifiedId(), format_aggregate_signature(), format_function_arguments(), format_function_signature(), gather_boolean_expression(), GenerateRecoveryConf(), get_create_object_cmd(), get_db_conn(), getAggregates(), getBlobs(), getCasts(), getDependencies(), getExtensionMembership(), getExtensions(), getFuncs(), getInherits(), getRules(), gets_fromFile(), getTables(), getTSParsers(), getTSTemplates(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), lookup_object_oid(), main(), makeAlterConfigCommand(), minimal_error_message(), objectDescription(), permissionsList(), pg_append_history(), pqBuildErrorMessage3(), pqCatenateResultError(), PQconnectPoll(), PQexecFinish(), pqGetErrorNotice2(), pqGetErrorNotice3(), pqPrepareAsyncResult(), prepare_vacuum_command(), processSQLNamePattern(), reindex_one_database(), report_multiple_error_messages(), reportErrorPosition(), restore_toc_entry(), RestoreArchive(), restoreErrorMessage(), runPgDump(), saveErrorMessage(), selectSourceSchema(), StreamLogicalLog(), and vacuum_one_database().

386 {
387  appendBinaryPQExpBuffer(str, data, strlen(data));
388 }
void appendBinaryPQExpBuffer(PQExpBuffer str, const char *data, size_t datalen)
Definition: pqexpbuffer.c:415
PQExpBuffer createPQExpBuffer ( void  )

Definition at line 71 of file pqexpbuffer.c.

References initPQExpBuffer(), and malloc.

Referenced by _doSetSessionAuth(), _doSetWithOids(), _printTocEntry(), _selectOutputSchema(), _selectTablespace(), _WriteBlobData(), appendStringLiteralDQ(), binary_upgrade_set_pg_class_oids(), binary_upgrade_set_type_oids_by_rel_oid(), binary_upgrade_set_type_oids_by_type_oid(), buildACLCommands(), buildDefaultACLCommands(), buildMatViewRefreshDependencies(), buildShSecLabels(), cluster_conn_opts(), collectComments(), collectSecLabels(), constructConnStr(), createDummyViewAsClause(), CreateReplicationSlot(), createViewAsClause(), DropReplicationSlot(), dropRoles(), dump_lo_buf(), dumpAccessMethod(), dumpACL(), dumpAgg(), dumpAttrDef(), dumpBaseType(), dumpBlob(), dumpCast(), dumpCollation(), dumpComment(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpCreateDB(), dumpDatabase(), dumpDatabaseConfig(), dumpDbRoleConfig(), dumpDefaultACL(), dumpDomain(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpGroups(), dumpIndex(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationTable(), dumpRangeType(), dumpRoleMembership(), dumpRoles(), dumpRule(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpShellType(), dumpStatisticsExt(), dumpStdStrings(), dumpSubscription(), dumpTable(), dumpTableComment(), dumpTableConstraintComment(), dumpTableData(), dumpTableData_copy(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpTSParser(), dumpTSTemplate(), dumpUndefinedType(), dumpUserConfig(), dumpUserMappings(), exec_command_sf_sv(), ExecuteSimpleCommands(), expand_schema_name_patterns(), expand_table_name_patterns(), findLastBuiltinOid_V71(), fmtQualifiedId(), gather_boolean_expression(), GenerateRecoveryConf(), get_create_object_cmd(), get_language_name(), getAccessMethods(), getAggregates(), getBlobs(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDependencies(), getDomainConstraints(), getEventTriggers(), getExtendedStatistics(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFormattedTypeName(), getFuncs(), getIndexes(), getInherits(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPolicies(), getProcLangs(), getPublications(), getPublicationTables(), getRules(), gets_fromFile(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), lockTableForWorker(), lookup_object_oid(), main(), MainLoop(), makeAlterConfigCommand(), minimal_error_message(), processExtensionTables(), refreshMatViewData(), RestoreArchive(), runPgDump(), selectSourceSchema(), setup_connection(), and StreamLogicalLog().

72 {
73  PQExpBuffer res;
74 
75  res = (PQExpBuffer) malloc(sizeof(PQExpBufferData));
76  if (res != NULL)
77  initPQExpBuffer(res);
78 
79  return res;
80 }
PQExpBufferData * PQExpBuffer
Definition: pqexpbuffer.h:51
#define malloc(a)
Definition: header.h:50
void initPQExpBuffer(PQExpBuffer str)
Definition: pqexpbuffer.c:89
void destroyPQExpBuffer ( PQExpBuffer  str)

Definition at line 113 of file pqexpbuffer.c.

References free, and termPQExpBuffer().

Referenced by _doSetSessionAuth(), _doSetWithOids(), _printTocEntry(), _selectOutputSchema(), _selectTablespace(), _WriteBlobData(), appendStringLiteralDQ(), BaseBackup(), binary_upgrade_set_pg_class_oids(), binary_upgrade_set_type_oids_by_rel_oid(), binary_upgrade_set_type_oids_by_type_oid(), buildACLCommands(), buildDefaultACLCommands(), buildMatViewRefreshDependencies(), buildShSecLabels(), collectComments(), collectSecLabels(), constructConnStr(), CreateReplicationSlot(), createViewAsClause(), DeCloneArchive(), DropReplicationSlot(), dropRoles(), dump_lo_buf(), dumpAccessMethod(), dumpACL(), dumpAgg(), dumpAttrDef(), dumpBaseType(), dumpBlob(), dumpCast(), dumpCollation(), dumpComment(), dumpCompositeType(), dumpCompositeTypeColComments(), dumpConstraint(), dumpConversion(), dumpCreateDB(), dumpDatabase(), dumpDatabaseConfig(), dumpDbRoleConfig(), dumpDefaultACL(), dumpDomain(), dumpEncoding(), dumpEnumType(), dumpEventTrigger(), dumpExtension(), dumpForeignDataWrapper(), dumpForeignServer(), dumpFunc(), dumpGroups(), dumpIndex(), dumpNamespace(), dumpOpclass(), dumpOpfamily(), dumpOpr(), dumpPolicy(), dumpProcLang(), dumpPublication(), dumpPublicationTable(), dumpRangeType(), dumpRoleMembership(), dumpRoles(), dumpRule(), dumpSecLabel(), dumpSequence(), dumpSequenceData(), dumpShellType(), dumpStatisticsExt(), dumpStdStrings(), dumpSubscription(), dumpTable(), dumpTableComment(), dumpTableConstraintComment(), dumpTableData(), dumpTableData_copy(), dumpTableData_insert(), dumpTableSchema(), dumpTableSecLabel(), dumpTablespaces(), dumpTransform(), dumpTrigger(), dumpTSConfig(), dumpTSDictionary(), dumpTSParser(), dumpTSTemplate(), dumpUndefinedType(), dumpUserConfig(), dumpUserMappings(), exec_command_sf_sv(), expand_schema_name_patterns(), expand_table_name_patterns(), findLastBuiltinOid_V71(), fmtQualifiedId(), get_create_object_cmd(), get_language_name(), getAccessMethods(), getAggregates(), getBlobs(), getCasts(), getCollations(), getConstraints(), getConversions(), getDefaultACLs(), getDependencies(), getDomainConstraints(), getEventTriggers(), getExtendedStatistics(), getExtensionMembership(), getExtensions(), getForeignDataWrappers(), getForeignServers(), getFormattedTypeName(), getFuncs(), getIndexes(), getInherits(), getNamespaces(), getOpclasses(), getOperators(), getOpfamilies(), getPolicies(), getProcLangs(), getPublications(), getPublicationTables(), getRules(), getSubscriptions(), getTableAttrs(), getTables(), getTransforms(), getTriggers(), getTSConfigurations(), getTSDictionaries(), getTSParsers(), getTSTemplates(), getTypes(), ignore_boolean_expression(), is_true_boolean_expression(), lockTableForWorker(), lookup_object_oid(), main(), MainLoop(), makeAlterConfigCommand(), minimal_error_message(), processExtensionTables(), refreshMatViewData(), RestoreArchive(), runPgDump(), selectSourceSchema(), setup_connection(), and StreamLogicalLog().

114 {
115  if (str)
116  {
117  termPQExpBuffer(str);
118  free(str);
119  }
120 }
void termPQExpBuffer(PQExpBuffer str)
Definition: pqexpbuffer.c:128
#define free(a)
Definition: header.h:65
int enlargePQExpBuffer ( PQExpBuffer  str,
size_t  needed 
)

Definition at line 171 of file pqexpbuffer.c.

References PQExpBufferData::data, PQExpBufferData::len, markPQExpBufferBroken(), PQExpBufferData::maxlen, PQExpBufferBroken, and realloc.

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

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

Definition at line 89 of file pqexpbuffer.c.

References PQExpBufferData::data, INITIAL_EXPBUFFER_SIZE, PQExpBufferData::len, malloc, PQExpBufferData::maxlen, and oom_buffer.

Referenced by _connectDB(), _reconnectToDB(), add_tablespace_footer(), appendPsqlMetaConnect(), build_client_final_message(), CloneArchive(), cluster_all_databases(), cluster_one_database(), conninfo_uri_parse_options(), create_new_objects(), create_script_for_cluster_analyze(), createPQExpBuffer(), describeAccessMethods(), describeAggregates(), describeFunctions(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), DescribeQuery(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), do_connect(), do_copy(), dumpDatabases(), exec_command_password(), ExecQueryUsingCursor(), format_aggregate_signature(), format_function_arguments(), format_function_arguments_old(), format_function_signature(), generate_old_dump(), GenerateRecoveryConf(), get_db_conn(), getCasts(), getParameterStatus(), getTransforms(), helpSQL(), libpqrcv_get_conninfo(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listOneExtensionContents(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), main(), makeEmptyPGconn(), new_9_0_populate_pg_largeobject_metadata(), objectDescription(), old_9_6_invalidate_hash_indexes(), ParseScript(), permissionsList(), pg_SASL_init(), pqCatenateResultError(), PQconndefaults(), PQconninfo(), PQconninfoParse(), pqGetErrorNotice2(), pqGetErrorNotice3(), PQresultVerboseErrorMessage(), process_backslash_command(), processSQLNamePattern(), psql_get_variable(), reindex_all_databases(), reindex_one_database(), reindex_system_catalogs(), report_multiple_error_messages(), resetPQExpBuffer(), restore_toc_entry(), saveErrorMessage(), vacuum_all_databases(), and vacuum_one_database().

90 {
91  str->data = (char *) malloc(INITIAL_EXPBUFFER_SIZE);
92  if (str->data == NULL)
93  {
94  str->data = (char *) oom_buffer; /* see comment above */
95  str->maxlen = 0;
96  str->len = 0;
97  }
98  else
99  {
101  str->len = 0;
102  str->data[0] = '\0';
103  }
104 }
#define malloc(a)
Definition: header.h:50
static const char oom_buffer[1]
Definition: pqexpbuffer.c:38
#define INITIAL_EXPBUFFER_SIZE
Definition: pqexpbuffer.h:76
void printfPQExpBuffer ( PQExpBuffer  str,
const char *  fmt,
  ... 
)
void resetPQExpBuffer ( PQExpBuffer  str)

Definition at line 145 of file pqexpbuffer.c.

References PQExpBufferData::data, initPQExpBuffer(), PQExpBufferData::len, and oom_buffer.

Referenced by closePGconn(), cluster_all_databases(), cluster_conn_opts(), connectDBComplete(), copyAclUserName(), describeOneTableDetails(), describeRoles(), do_edit(), dumpBlob(), dumpCompositeTypeColComments(), dumpCreateDB(), dumpDatabase(), dumpOpclass(), dumpOpfamily(), dumpRoles(), dumpSequence(), dumpSequenceData(), dumpTableComment(), dumpTableData_insert(), dumpTableSecLabel(), dumpTSConfig(), dumpUserMappings(), exec_command_ef_ev(), exec_command_reset(), exec_command_watch(), ExecuteSimpleCommands(), expand_schema_name_patterns(), expand_table_name_patterns(), findLastBuiltinOid_V71(), get_create_object_cmd(), getConstraints(), getExtendedStatistics(), getIndexes(), getPolicies(), getPublications(), getPublicationTables(), gets_fromFile(), getSubscriptions(), getTableAttrs(), getTables(), getTriggers(), MainLoop(), parseAclItem(), ParseScript(), pg_send_history(), pqEndcopy2(), pqEndcopy3(), PQexecFinish(), PQfn(), pqGetErrorNotice2(), pqGetErrorNotice3(), pqGets_internal(), pqPrepareAsyncResult(), PQputCopyEnd(), PQsendQueryStart(), prepare_vacuum_command(), printfPQExpBuffer(), processSQLNamePattern(), reindex_all_databases(), restoreErrorMessage(), saveErrorMessage(), StreamLogicalLog(), vacuum_all_databases(), and vacuum_one_database().

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

Definition at line 128 of file pqexpbuffer.c.

References PQExpBufferData::data, free, PQExpBufferData::len, PQExpBufferData::maxlen, and oom_buffer.

Referenced by _connectDB(), _reconnectToDB(), add_tablespace_footer(), appendPsqlMetaConnect(), build_client_final_message(), CloneArchive(), cluster_all_databases(), cluster_one_database(), conninfo_uri_parse_options(), create_new_objects(), create_script_for_cluster_analyze(), describeAccessMethods(), describeAggregates(), describeFunctions(), describeOneTableDetails(), describeOneTSConfig(), describeOneTSParser(), describeOperators(), describePublications(), DescribeQuery(), describeRoles(), describeSubscriptions(), describeTableDetails(), describeTablespaces(), describeTypes(), destroyPQExpBuffer(), do_connect(), do_copy(), dumpDatabases(), exec_command_password(), ExecQueryUsingCursor(), freePGconn(), generate_old_dump(), GenerateRecoveryConf(), get_db_conn(), getParameterStatus(), libpqrcv_get_conninfo(), listAllDbs(), listCasts(), listCollations(), listConversions(), listDbRoleSettings(), listDefaultACLs(), listDomains(), listEventTriggers(), listExtensionContents(), listExtensions(), listForeignDataWrappers(), listForeignServers(), listForeignTables(), listLanguages(), listOneExtensionContents(), listPublications(), listSchemas(), listTables(), listTSConfigs(), listTSConfigsVerbose(), listTSDictionaries(), listTSParsers(), listTSParsersVerbose(), listTSTemplates(), listUserMappings(), main(), new_9_0_populate_pg_largeobject_metadata(), objectDescription(), old_9_6_invalidate_hash_indexes(), ParseScript(), permissionsList(), pg_SASL_init(), pqCatenateResultError(), PQconndefaults(), PQconnectPoll(), PQconninfo(), PQconninfoParse(), pqGetErrorNotice2(), pqGetErrorNotice3(), PQresultVerboseErrorMessage(), process_backslash_command(), processSQLNamePattern(), reindex_all_databases(), reindex_one_database(), reindex_system_catalogs(), report_multiple_error_messages(), restoreErrorMessage(), vacuum_all_databases(), and vacuum_one_database().

129 {
130  if (str->data != oom_buffer)
131  free(str->data);
132  /* just for luck, make the buffer validly empty. */
133  str->data = (char *) oom_buffer; /* see comment above */
134  str->maxlen = 0;
135  str->len = 0;
136 }
static const char oom_buffer[1]
Definition: pqexpbuffer.c:38
#define free(a)
Definition: header.h:65