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

Function transformFormatType

src/backend/commands/exttablecmds.c:593–611  ·  view source on GitHub ↗

* Transform format name for external table FORMAT option to format code and * validate that the requested format is supported. */

Source from the content-addressed store, hash-verified

591 * validate that the requested format is supported.
592 */
593static char
594transformFormatType(char *formatname)
595{
596 char result = '\0';
597
598 if (pg_strcasecmp(formatname, "text") == 0)
599 result = 't';
600 else if (pg_strcasecmp(formatname, "csv") == 0)
601 result = 'c';
602 else if (pg_strcasecmp(formatname, "custom") == 0)
603 result = 'b';
604 else
605 ereport(ERROR,
606 (errcode(ERRCODE_SYNTAX_ERROR),
607 errmsg("unsupported format '%s'", formatname),
608 errhint("Available formats for external tables are \"text\", \"csv\" and \"custom\".")));
609
610 return result;
611}
612
613/*
614 * Join the elements of the list separated by the specified delimiter and

Callers 1

DefineExternalRelationFunction · 0.85

Calls 4

pg_strcasecmpFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
errhintFunction · 0.50

Tested by

no test coverage detected