MCPcopy Create free account
hub / github.com/apache/cloudberry / cluster_one_database

Function cluster_one_database

src/bin/scripts/clusterdb.c:195–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193
194
195static void
196cluster_one_database(const ConnParams *cparams, const char *table,
197 const char *progname, bool verbose, bool echo)
198{
199 PQExpBufferData sql;
200
201 PGconn *conn;
202
203 conn = connectDatabase(cparams, progname, echo, false, false);
204
205 initPQExpBuffer(&sql);
206
207 appendPQExpBufferStr(&sql, "CLUSTER");
208 if (verbose)
209 appendPQExpBufferStr(&sql, " VERBOSE");
210 if (table)
211 {
212 appendPQExpBufferChar(&sql, ' ');
213 appendQualifiedRelation(&sql, table, conn, echo);
214 }
215 appendPQExpBufferChar(&sql, ';');
216
217 if (!executeMaintenanceCommand(conn, sql.data, echo))
218 {
219 if (table)
220 pg_log_error("clustering of table \"%s\" in database \"%s\" failed: %s",
221 table, PQdb(conn), PQerrorMessage(conn));
222 else
223 pg_log_error("clustering of database \"%s\" failed: %s",
224 PQdb(conn), PQerrorMessage(conn));
225 PQfinish(conn);
226 exit(1);
227 }
228 PQfinish(conn);
229 termPQExpBuffer(&sql);
230}
231
232
233static void

Callers 2

mainFunction · 0.85
cluster_all_databasesFunction · 0.85

Calls 10

initPQExpBufferFunction · 0.85
appendPQExpBufferStrFunction · 0.85
appendPQExpBufferCharFunction · 0.85
appendQualifiedRelationFunction · 0.85
PQdbFunction · 0.85
PQerrorMessageFunction · 0.85
PQfinishFunction · 0.85
termPQExpBufferFunction · 0.85
connectDatabaseFunction · 0.50

Tested by

no test coverage detected