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

Function fmtCopyColumnList

src/bin/pg_dump/pg_dump.c:21372–21401  ·  view source on GitHub ↗

* Return a column list clause for the given relation. * * Special case: if there are no undropped columns in the relation, return * "", not an invalid "()" column list. */

Source from the content-addressed store, hash-verified

21370 * "", not an invalid "()" column list.
21371 */
21372static const char *
21373fmtCopyColumnList(const TableInfo *ti, PQExpBuffer buffer)
21374{
21375 int numatts = ti->numatts;
21376 char **attnames = ti->attnames;
21377 bool *attisdropped = ti->attisdropped;
21378 char *attgenerated = ti->attgenerated;
21379 bool needComma;
21380 int i;
21381
21382 appendPQExpBufferChar(buffer, '(');
21383 needComma = false;
21384 for (i = 0; i < numatts; i++)
21385 {
21386 if (attisdropped[i])
21387 continue;
21388 if (attgenerated[i])
21389 continue;
21390 if (needComma)
21391 appendPQExpBufferStr(buffer, ", ");
21392 appendPQExpBufferStr(buffer, fmtId(attnames[i]));
21393 needComma = true;
21394 }
21395
21396 if (!needComma)
21397 return ""; /* no undropped columns */
21398
21399 appendPQExpBufferChar(buffer, ')');
21400 return buffer->data;
21401}
21402
21403/*
21404 * Check if a reloptions array is nonempty.

Callers 2

dumpTableData_copyFunction · 0.85
dumpTableDataFunction · 0.85

Calls 3

appendPQExpBufferCharFunction · 0.85
appendPQExpBufferStrFunction · 0.85
fmtIdFunction · 0.85

Tested by

no test coverage detected