| 5704 | |
| 5705 | |
| 5706 | inline static void |
| 5707 | AppendUniqueColumnExpr(StringInfo indexExprStr, IndexDefKey *indexDefKey, |
| 5708 | bool sparse, const char *indexAmSuffix, const |
| 5709 | char *indexAmOpClassInternalCatalogSchema, |
| 5710 | bool firstColumnWritten, bool buildAsUnique, |
| 5711 | bool generateCompositeHash) |
| 5712 | { |
| 5713 | const char *generateCompositeTermString = ""; |
| 5714 | if (generateCompositeHash && IsClusterVersionAtleast(DocDB_V0, 109, 0) && |
| 5715 | EnableCompositeShardDocumentTerms) |
| 5716 | { |
| 5717 | generateCompositeTermString = ", true"; |
| 5718 | } |
| 5719 | |
| 5720 | appendStringInfo(indexExprStr, |
| 5721 | "%s%s.generate_unique_shard_document(document, shard_key_value, '%s'::%s.bson, %s%s) %s.bson_%s_unique_shard_path_ops%s", |
| 5722 | !firstColumnWritten ? "" : ",", |
| 5723 | DocumentDBApiInternalSchemaName, |
| 5724 | GenerateUniqueProjectionSpec(indexDefKey), |
| 5725 | CoreSchemaName, |
| 5726 | sparse ? "true" : "false", |
| 5727 | generateCompositeTermString, |
| 5728 | indexAmOpClassInternalCatalogSchema, |
| 5729 | indexAmSuffix, |
| 5730 | generateCompositeHash ? "(cmp=true)" : ""); |
| 5731 | |
| 5732 | if (!buildAsUnique) |
| 5733 | { |
| 5734 | appendStringInfo(indexExprStr, " WITH OPERATOR(%s.=#=)", |
| 5735 | DocumentDBApiInternalSchemaName); |
| 5736 | } |
| 5737 | } |
| 5738 | |
| 5739 | |
| 5740 | /* |
no test coverage detected