Files
documentdb/pg_documentdb/src/pg_documentdb.c
T
Zinan Ren ee069245a9 Merged PR 1555452: [OSS] Enable distributed tests in documentdb
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

Enable distributed tests in documentdb, and clean up helio references from documentdb_distributed
Add substitution to make pg_helio_distributed tests work
Add substitution to make pgmongo/helio_compat tests work
Move udfs bson_aggregation_redact to documentdb

----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request enables distributed tests in DocumentDB by adding a new set of regression tests for BSON aggregation comparison operators.
- Added `bson_aggregation_comparison_operators_tests.out` with extensive test cases for BSON comparison operators (`$cmp`, `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`).
2025-01-22 22:24:35 -08:00

72 lines
1.5 KiB
C

/*-------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* src/pg_documentdb.c
*
* Initialization of the shared library for the DocumentDB API.
*-------------------------------------------------------------------------
*/
#include <postgres.h>
#include <fmgr.h>
#include <miscadmin.h>
#include <utils/guc.h>
#include "bson_init.h"
#include "utils/feature_counter.h"
#include "documentdb_api_init.h"
PG_MODULE_MAGIC;
void _PG_init(void);
void _PG_fini(void);
bool SkipDocumentDBLoad = false;
/*
* _PG_init gets called when the extension is loaded.
*/
void
_PG_init(void)
{
if (SkipDocumentDBLoad)
{
return;
}
if (!process_shared_preload_libraries_in_progress)
{
ereport(ERROR, (errmsg(
"pg_documentdb can only be loaded via shared_preload_libraries"),
errdetail_log(
"Add pg_documentdb to shared_preload_libraries configuration "
"variable in postgresql.conf. ")));
}
InstallBsonMemVTables();
InitApiConfigurations("documentdb", "documentdb");
InitializeSharedMemoryHooks();
MarkGUCPrefixReserved("documentdb");
InitializeDocumentDBBackgroundWorker("pg_documentdb", "documentdb", "documentdb");
InstallDocumentDBApiPostgresHooks();
ereport(LOG, (errmsg("Initialized pg_documentdb extension")));
}
/*
* _PG_fini is called before the extension is reloaded.
*/
void
_PG_fini(void)
{
if (SkipDocumentDBLoad)
{
return;
}
UninstallDocumentDBApiPostgresHooks();
}