* command_drop_indexes is the implementation of the internal logic for * dbcommand/dropIndexes. */
| 108 | * dbcommand/dropIndexes. |
| 109 | */ |
| 110 | Datum |
| 111 | command_drop_indexes(PG_FUNCTION_ARGS) |
| 112 | { |
| 113 | if (PG_ARGISNULL(1)) |
| 114 | { |
| 115 | ereport(ERROR, (errmsg("Argument value must not be NULL"))); |
| 116 | } |
| 117 | pgbson *arg = PG_GETARG_PGBSON(1); |
| 118 | |
| 119 | Datum dbNameDatum = PG_ARGISNULL(0) ? (Datum) 0 : PG_GETARG_DATUM(0); |
| 120 | DropIndexesArg dropIndexesArg = ParseDropIndexesArg(arg, &dbNameDatum); |
| 121 | |
| 122 | if (dbNameDatum == (Datum) 0) |
| 123 | { |
| 124 | ereport(ERROR, (errmsg("dbName cannot be NULL"))); |
| 125 | } |
| 126 | char *dbName = TextDatumGetCString(dbNameDatum); |
| 127 | |
| 128 | bool dropIndexConcurrently = false; |
| 129 | DropIndexesResult dropIndexResult = ProcessDropIndexesRequest(dbName, dropIndexesArg, |
| 130 | dropIndexConcurrently); |
| 131 | Datum values[1] = { 0 }; |
| 132 | bool isNulls[1] = { false }; |
| 133 | values[0] = PointerGetDatum(MakeDropIndexesMsg(&dropIndexResult)); |
| 134 | |
| 135 | /* fetch TupleDesc for result, not interested in resultTypeId */ |
| 136 | Oid *resultTypeId = NULL; |
| 137 | TupleDesc resultTupDesc = NULL; |
| 138 | if (get_call_result_type(fcinfo, resultTypeId, &resultTupDesc) == TYPEFUNC_SCALAR) |
| 139 | { |
| 140 | PG_RETURN_DATUM(values[0]); |
| 141 | } |
| 142 | |
| 143 | PG_RETURN_DATUM(HeapTupleGetDatum(heap_form_tuple(resultTupDesc, values, isNulls))); |
| 144 | } |
| 145 | |
| 146 | |
| 147 | /* |
nothing calls this directly
no test coverage detected