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

Function exec_command_d

src/bin/psql/command.c:700–958  ·  view source on GitHub ↗

* \d* commands */

Source from the content-addressed store, hash-verified

698 * \d* commands
699 */
700static backslashResult
701exec_command_d(PsqlScanState scan_state, bool active_branch, const char *cmd)
702{
703 backslashResult status = PSQL_CMD_SKIP_LINE;
704 bool success = true;
705
706 if (active_branch)
707 {
708 char *pattern;
709 bool show_verbose,
710 show_system;
711
712 /* We don't do SQLID reduction on the pattern yet */
713 pattern = psql_scan_slash_option(scan_state,
714 OT_NORMAL, NULL, true);
715
716 show_verbose = strchr(cmd, '+') ? true : false;
717 show_system = strchr(cmd, 'S') ? true : false;
718
719 switch (cmd[1])
720 {
721 case '\0':
722 case '+':
723 case 'S': /* GPDB: This is a change from old behavior: We used to show just system tables */
724 if (pattern)
725 success = describeTableDetails(pattern, show_verbose, show_system);
726 else
727 /* standard listing of interesting things */
728 success = listTables("tvmsE", NULL, show_verbose, show_system);
729 break;
730 case 'A':
731 {
732 char *pattern2 = NULL;
733
734 if (pattern && cmd[2] != '\0' && cmd[2] != '+')
735 pattern2 = psql_scan_slash_option(scan_state, OT_NORMAL, NULL, true);
736
737 switch (cmd[2])
738 {
739 case '\0':
740 case '+':
741 success = describeAccessMethods(pattern, show_verbose);
742 break;
743 case 'c':
744 success = listOperatorClasses(pattern, pattern2, show_verbose);
745 break;
746 case 'f':
747 success = listOperatorFamilies(pattern, pattern2, show_verbose);
748 break;
749 case 'o':
750 success = listOpFamilyOperators(pattern, pattern2, show_verbose);
751 break;
752 case 'p':
753 success = listOpFamilyFunctions(pattern, pattern2, show_verbose);
754 break;
755 default:
756 status = PSQL_CMD_UNKNOWN;
757 break;

Callers 1

exec_commandFunction · 0.85

Calls 15

describeTableDetailsFunction · 0.85
listTablesFunction · 0.85
describeAccessMethodsFunction · 0.85
listOperatorClassesFunction · 0.85
listOperatorFamiliesFunction · 0.85
listOpFamilyOperatorsFunction · 0.85
listOpFamilyFunctionsFunction · 0.85
describeAggregatesFunction · 0.85
describeTablespacesFunction · 0.85
listConversionsFunction · 0.85
listCastsFunction · 0.85
listDefaultACLsFunction · 0.85

Tested by

no test coverage detected