Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First request for Mongo FDW #26

Open
wants to merge 250 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
250 commits
Select commit Hold shift + click to select a range
4261680
Remove existing mongo-c-driver directory
jasonmp85 Jan 23, 2014
5d8aee5
Add back mongo-c-driver as submodule, lock to v0.6
jasonmp85 Jan 23, 2014
3d3d363
Update README to explain submodule initialization
jasonmp85 Jan 23, 2014
22a6f44
Switch to relative URL for submodule
jasonmp85 Jan 23, 2014
eb21c86
Initial code needed to output json.
x746e May 13, 2014
c86e655
First working prototype.
x746e May 13, 2014
1819c78
Added support for serializing objects.
x746e May 13, 2014
92d04ac
Merge remote-tracking branch 'origin/feature/use_submodule_for_driver'
x746e May 13, 2014
2ac3c01
Updated the extension to work with mongo c driver v0.8.
x746e May 13, 2014
8b24bca
Merge commit '2ac3c01' into json-type
x746e May 14, 2014
5b430f2
Removed some worthless code.
x746e May 14, 2014
d3f8b83
Updated mongo c driver to version 0.8.1.
x746e May 14, 2014
02ceca1
Changed print_json to use StringInfo.
x746e May 14, 2014
e953061
Added string escaping for json.
x746e May 14, 2014
6b1afd2
Code style changes.
x746e May 15, 2014
7aa4145
Added basic pgregress tests.
x746e May 25, 2014
f788c36
Merge branch 'pgregress' into json-type+tests
x746e May 25, 2014
89448c4
Added regression test for JSON datatype.
x746e May 25, 2014
c632ac4
Code cleanup.
x746e May 25, 2014
fca6bb0
Connection Pooler for mongodb similar to PostgreSQL FDW.
ibrarahmed1974 Jun 2, 2014
955350c
Plemove DeserializeDocument and SerializeDocument functions which are
ibrarahmed1974 Jun 2, 2014
d8d8f48
Write support (INSERT/UPDATE/DELETE).
ibrarahmed1974 Jun 2, 2014
5f881c9
MongoDB's Meta Driver support added.
ibrarahmed1974 Jun 2, 2014
3dd8ef6
Added files missed during last commits.
ibrarahmed1974 Jun 2, 2014
aacb0c8
Restrict first column name of MongoDB's foreign table to "_id".
ibrarahmed1974 Jun 2, 2014
b67102c
README Changes
ibrarahmed1974 Jun 2, 2014
a501e6d
README file typos and cosmetic changes.
ibrarahmed1974 Jun 2, 2014
4ead1e4
Compiler warning of unused variable fixed.
ibrarahmed1974 Jun 2, 2014
2e5a491
Default Makefile to compile FDW with MongoDB's legacy Driver.
ibrarahmed1974 Jun 2, 2014
e31a193
Licence information update
ibrarahmed1974 Jun 2, 2014
0fe3122
README file changes.
ibrarahmed1974 Jun 2, 2014
9f971d9
Numeric array support for MongoDB's legacy and meta driver added
ibrarahmed1974 Jun 4, 2014
bce5fc3
README file changes
ibrarahmed1974 Jun 5, 2014
1fd94bc
README file changes.
ibrarahmed1974 Jun 6, 2014
2007c72
Throw error in case type of first column of MongoDB's foreign Table n…
ibrarahmed1974 Jun 6, 2014
990bdf1
Wrong BSON object was passed in case of Meta Drive
ibrarahmed1974 Jun 6, 2014
87b026c
The "analyze" statement throwing error while retrieving rows from Mon…
ibrarahmed1974 Jun 9, 2014
9f7e125
Misc changes to readme
ahsanhadi Jun 24, 2014
19f16f4
Update CONTRIBUTING.md
ahsanhadi Jun 24, 2014
08bbee6
Authentication using USER mapping
ibrarahmed1974 Jul 10, 2014
f4f6c42
README Changes for user mapping
ibrarahmed1974 Jul 10, 2014
9b66014
Merge commit 'c632ac480e6fffc79c32845a34488574fc5bc685'
truongsinh Sep 24, 2014
0223b23
Merge pull request #2 from truongsinh/master
ibrarahmad Sep 25, 2014
9da15a0
License header change
ibrarahmad Sep 30, 2014
b6aa5e1
PostgreSQL Version 9.5 support
ibrarahmad Sep 30, 2014
f814283
PostgreSQL Version 9.5 support
ibrarahmad Sep 30, 2014
c9b3461
README File changes
ibrarahmad Sep 30, 2014
e5d1ec0
Error message typos fix
ibrarahmad Oct 1, 2014
8167398
README typo fix
ibrarahmad Oct 1, 2014
a4b043c
Function name change in connection.c and option. c
ibrarahmad Oct 1, 2014
da603d5
README Changes
ibrarahmad Oct 1, 2014
8e6ca32
read/write binary data (bytea)
truongsinh Oct 2, 2014
486e7d6
Merge pull request #4 from truongsinh/master
ibrarahmad Oct 2, 2014
6cdfae1
attempting to get mongo meta driver to work with 1.0.2 mongo c drivers
Oct 16, 2014
1f705b1
Removing mongo-c-meta-driver submodule
Oct 20, 2014
851f954
Update README.md
Oct 29, 2014
7a3d32e
support write text[] (TEXTARRAYOID)
truongsinh Oct 28, 2014
9872f6f
Merge pull request #6 from truongsinh/master
ibrarahmad Oct 30, 2014
c25671b
Error #7: Fixed compiler warning
ibrarahmad Oct 30, 2014
5794527
Error #8: Using serverid and userid for connection pooling instead of…
ibrarahmad Oct 30, 2014
005b342
Fixed some formating issues.
ibrarahmad Oct 30, 2014
2ad3238
Change the Option's variable name from mongoFdwOptions to options
ibrarahmad Oct 30, 2014
463046f
fixing json dumps logic for meta driver
Nov 3, 2014
3a1a952
fixing segfault for json data types
mjburghoffer Nov 4, 2014
a377975
adding ability to represent _id as bytea and also query by bytea
mjburghoffer Nov 4, 2014
8b10947
Merge remote-tracking branch 'upstream/master'
Nov 4, 2014
e7f4d81
fixing whitespace
Nov 4, 2014
d8bdbcc
fixing some compile errors
mjburghoffer Nov 4, 2014
32f9e6f
fixing compile issues
mjburghoffer Nov 4, 2014
c04e60f
fixing compile issues for legacy drivers
mjburghoffer Nov 4, 2014
82ed8e4
Merge pull request #12 from mjburghoffer/master
ibrarahmad Nov 5, 2014
ce02067
Fix compilation warning cause by
ibrarahmad Nov 5, 2014
d4b3cae
Fixing compiler warning while compiling using Mongo C Meta Driver.
ibrarahmad Nov 5, 2014
9fda4cd
Adding script to automate the process of compiling different drivers …
ibrarahmad Nov 5, 2014
502efca
Added missing file "Makefile.legacy"
ibrarahmad Nov 6, 2014
cc070a8
write JSON (object and array)
truongsinh Nov 7, 2014
5bae0f8
$date and $oid
truongsinh Nov 7, 2014
c6e8a05
Merge pull request #13 from truongsinh/master
ibrarahmad Nov 7, 2014
9211389
- Fix the compilation warnings introduced by this pull request
ibrarahmad Nov 11, 2014
7f26682
README file changes
ibrarahmad Nov 11, 2014
c66ef97
Fixed a unresolved symbol error, and some cosmetic changes.
ibrarahmad Nov 14, 2014
a159d42
Disable JSON write support (Meta Driver only),
ibrarahmad Nov 14, 2014
a9261b6
Fix a crash while fetching remote row count using MongoDB's Meta C Dr…
ibrarahmad Feb 25, 2015
cdbd6b6
Error - (#22)Remove git dependency from autogen.sh, and download
ibrarahmad Feb 25, 2015
3ce043d
Error - (#23) Regression test cases added
ibrarahmad Feb 25, 2015
92c0f0b
Error - (#23) Regression test cases for Meta Driver (Makefile change).
ibrarahmad Feb 25, 2015
2e61e28
Error - (#24) Removed error message in case of no rows.
ibrarahmad Feb 25, 2015
b473d35
Error - (#23) Test case update
ibrarahmad Feb 25, 2015
0550351
JSON-C compilation error patch.
ibrarahmad Feb 26, 2015
94b149e
Specify database in connection URI for meta driver.
ibrarahmad Feb 27, 2015
7a717b5
Fix autogen.sh to help building mongo-c
Aug 25, 2015
0ca0870
Error - (#10) Adding JSON support while using Mongo Meta driver.
ibrarahmad Aug 25, 2015
34b6025
Merge pull request #35 from Byron/master
ibrarahmad Sep 11, 2015
b174c63
Error (#36) Fix a crash while using nested field
ibrarahmad Sep 11, 2015
179374e
Error ((#38) Nested field has column type 0, so we
ibrarahmad Oct 20, 2015
b14fc7d
Implement BsonIterSubObject for the meta driver. Fixes #34 and #38.
Nov 28, 2015
d3302c9
Merge pull request #40 from bremac/fix-sub-objects
ibrarahmad Nov 29, 2015
4078a89
Added PostgreSQL 9.5 support.
ibrarahmad Dec 3, 2015
a4ce167
Fix PostgreSQL 9.5 build and remove some compilation warnings.
ibrarahmad Jan 18, 2016
632e78c
Error (#32) full document retrieval.
ibrarahmad Jan 28, 2016
c797230
New Mongo'C Driver (mongo-c-driver-1.3.1.tar.gz) support in autogen.s…
ibrarahmad Jan 28, 2016
42c0f7b
Error (#32) Disable INSERT and UPDATE on __doc system column.
ibrarahmad Jan 29, 2016
4b2947b
README update
ibrarahmad May 23, 2016
28f7369
Added support for ssl in meta driver, also cleaned a duplicated line.
Oct 25, 2016
df043d7
Issue - (#67) PostgreSQL 9.6 support.
ibrarahmed1974 Dec 15, 2016
d04a7e6
Issue - (#67) PostgreSQL 9.6 support.
ibrarahmed1974 Dec 17, 2016
e0e11ee
README update.
ibrarahmad Dec 19, 2016
3309719
Merge pull request #69 from GaelMagnan/master
ibrarahmad Jan 2, 2017
17687ce
Issue (#72) Provide support for JSONB as type of special __doc column
gabbasb Feb 13, 2017
d66eaa2
Merge pull request #73 from gabbasb/master
ibrarahmad Feb 14, 2017
265f72f
Issue (#64) Add support for push down of parameterized where clause
gabbasb Feb 21, 2017
13ff120
Merge pull request #75 from gabbasb/master
ibrarahmad Feb 22, 2017
15ea688
Added support for authentication database in the CREATE SERVER declar…
Mar 8, 2017
510388f
Added support for replica set in the CREATE SERVER declaration.
Mar 8, 2017
9dfa6ae
Update json-c to 0.12.1
dtheodor Mar 10, 2017
2bdb0eb
Merge pull request #77 from Reimus/master
ibrarahmad Apr 22, 2017
b971288
Issue - (#88) - PostgreSQL 10 compilation issue.
ibrarahmad Oct 15, 2017
657c150
Add PostgreSQL version 10 to all Makefiles
andreasscherbaum Dec 1, 2017
a318751
Update version number from 10 to 10.0
andreasscherbaum Dec 12, 2017
8074972
Merge pull request #92 from andreasscherbaum/makefiles_pg10
ibrarahmad Jan 3, 2018
ba88931
Merge pull request #79 from dtheodor/master
ibrarahmad Jan 3, 2018
84d1638
Fix for issue #99, Prepare to release for 5.1
gabbasb Mar 13, 2018
8307ced
Fixed a build issue
ahsanhadi Mar 14, 2018
83ed3ee
Update mongo_fdw.c
ahsanhadi Mar 14, 2018
35fe193
Fix issue #100, CREATE EXTENSION fails due to missing sql files
gabbasb Mar 21, 2018
e16476e
Bump version of mongo-c-driver
jjlakis May 10, 2018
450e165
Merge pull request #101 from jjlakis/mongo-c-bump
ibrarahmad May 14, 2018
4ef4341
Issue - #105: Fix crash while selecting data.
ibrarahmad Aug 7, 2018
1d4dd2d
Merge pull request #106 from ibrarahmad/master
ahsanhadi Aug 20, 2018
3235892
Support PG/EPAS 11.
rblathia Oct 25, 2018
83b7134
Add PostgreSQL version 11 to all Makefiles.
rblathia Oct 26, 2018
09b4248
Fix a build issue with v11.
rblathia Nov 1, 2018
fa7a260
Issue - (#113): Fix compilation error of the json-c library.
ibrarahmad Dec 10, 2018
ee7dfe7
Merge pull request #114 from ibrarahmad/master
ahsanhadi Dec 20, 2018
063957b
Remove unnecessary cd into a subdir, followed by a cd back up
andreasscherbaum Jan 11, 2019
6d7a341
Add $(LIBJSON)/strerror_override.o to $LIBJSON_OBJS
andreasscherbaum Jan 12, 2019
fea3d3c
Merge pull request #119 from andreasscherbaum/strerror_override
ahsanhadi Jan 25, 2019
6d06a82
Merge pull request #118 from andreasscherbaum/unnecessary_cd
ahsanhadi Jan 25, 2019
3775585
Make "tar" non-verbose (#117)
andreasscherbaum Mar 31, 2019
5fe371a
Avoid error message when config.h does not exist (#116)
andreasscherbaum Mar 31, 2019
3c5b1f5
Support PG/EPAS 12,
rblathia Sep 27, 2019
272b293
Support PG/EPAS 12.
rblathia Sep 27, 2019
5eaa0bf
Fix build for v11.
rblathia Sep 27, 2019
4416dc9
Fix compiler warnings.
jeevanchalke May 6, 2020
27eb375
Fix and improve the regression test.
jeevanchalke May 6, 2020
c32aa06
Add support for EPAS 13.
jeevanchalke May 6, 2020
6c0a8f8
Add gitattributes.
jeevanchalke May 29, 2020
7bd1f34
Re-establish mongo_fdw connections after server or user mapping changes.
jeevanchalke May 29, 2020
d509e4a
Update EDB copyrights for 2020.
jeevanchalke Jun 17, 2020
a2967a9
Run pgindent.
jeevanchalke Jun 17, 2020
b429cb6
Do some code cleanup and refactoring.
jeevanchalke Jun 23, 2020
278ce1b
Add one missing header file, and fix compilation warning.
jeevanchalke Jun 23, 2020
8ce1225
Check that the existing or new connection is reachable/active or not.
jeevanchalke Jul 7, 2020
61f2bdb
Fix ANALYZE.
jeevanchalke Jul 8, 2020
08c62ed
Split a single testcase file into multiple files.
jeevanchalke Jul 22, 2020
63db08c
Update README and CONTRIBUTING files.
jeevanchalke Jul 29, 2020
aaeb6c7
Stamp 5.2.7.
jeevanchalke Aug 3, 2020
9b4843b
Change the server port option's type from int32 to uint16.
jeevanchalke Sep 20, 2020
72ac0c0
Fix an alternate expected out file.
jeevanchalke Sep 22, 2020
3571072
Fix ReScanForeignScan API to make the parameterized query work
jeevanchalke Sep 26, 2020
de5db6e
Fix issue where casting target list produces 'NULL'.
jeevanchalke Oct 12, 2020
c4412a4
Fix crash with COPY FROM and/or foreign partition routing operations.
jeevanchalke Oct 12, 2020
9b798ec
Update LICENSE file.
jeevanchalke Oct 21, 2020
b4c1d76
Stamp 5.2.8.
jeevanchalke Oct 27, 2020
27ee19d
Fix crash with LEFT JOIN LATERAL queries.
jeevanchalke Dec 1, 2020
a815df8
Add a few more tests testing COPY FROM and target list casting.
jeevanchalke Dec 10, 2020
6f409d7
Move to the latest version of mongo-c-driver.
jeevanchalke Dec 11, 2020
93e1362
Add JSONC_CFLAGS environment variable to cmake while building json-c.
jeevanchalke Jan 21, 2021
b6caf62
Restrict fetching system attributes from the remote relation.
jeevanchalke Feb 1, 2021
fce56c6
Rfactor WHERE pushdown code.
jeevanchalke Feb 3, 2021
654780f
Update EDB copyrights for 2021.
jeevanchalke Feb 9, 2021
1abfac7
Push only OpExpr clauses to the remote server.
jeevanchalke Feb 23, 2021
b0e5c3f
Remove support for v9.5.
jeevanchalke Feb 26, 2021
91a5cc3
Revert "Update LICENSE file."
jeevanchalke Mar 11, 2021
6e75904
Correct the exit status in autogen.sh.
jeevanchalke Jun 14, 2021
8e62592
Fall back to cmake if cmake3 is not present.
jeevanchalke Jun 14, 2021
ceb03dc
Stamp 5.2.9.
jeevanchalke Jun 15, 2021
1fbc190
Add support for PostgreSQL 14 and EDB Postgres Advanced Server 14.
jeevanladhe Jul 1, 2021
b559c3e
Use environment variables in tests for connection parameters.
jeevanchalke Aug 2, 2021
2f20c4a
Fix expected output differences due to hint messages.
jeevanladhe Aug 14, 2021
85994ba
Fix the implementation for retrieving and validating the options.
jeevanladhe Aug 14, 2021
3d43081
Update default value for option weak_cert_validation in README.
jeevanladhe Sep 9, 2021
434b47a
Allow mongo-c and json-c drivers installation at custom locations.
jeevanladhe Sep 10, 2021
3205c5b
Stamp 5.2.10.
jeevanchalke Sep 15, 2021
67ae36c
Optimize and rename ColumnList() to mongo_get_column_list().
jeevanladhe Oct 26, 2021
d768fc7
Add support for whole-row reference.
jeevanladhe Oct 26, 2021
2f6c2bc
Refactor code a bit.
jeevanchalke Nov 15, 2021
198753b
Push down joins to the remote MongoDB servers.
jeevanchalke Nov 15, 2021
9fff635
Don't support join pushdown in legacy mode.
jeevanchalke Nov 15, 2021
68cff4f
Add test coverage for the join push-down feature.
jeevanchalke Nov 15, 2021
cdfaf88
Add enable_join_pushdown option to control join push-down.
jeevanchalke Nov 15, 2021
801ad71
Add join push-down note in README.
jeevanchalke Nov 16, 2021
d0e030d
Make regression consistent on rhel8 by changing the host details.
jeevanchalke Nov 16, 2021
562d2d2
Stamp 5.3.0.
jeevanchalke Nov 18, 2021
79908ec
Update EDB copyrights for 2022.
jeevanchalke Jan 18, 2022
1ac1a25
Make Meta the default compilation driver instead of legacy.
jeevanchalke Jan 18, 2022
87fa87a
README: Add instructions for driver installation and other cosmetic
jeevanladhe Jan 19, 2022
e41cfde
Add new server option use_remote_estimate.
jeevanchalke Feb 16, 2022
a46f90c
Force type modifiers for numeric type.
jeevanchalke Feb 17, 2022
c621481
Fix data type incompatibility between numeric types.
jeevanchalke Feb 21, 2022
a008692
Rename a few function names to be more inline with the postgres_fdw.
jeevanchalke Feb 21, 2022
28df773
Remove support for v9.6.
jeevanchalke Mar 27, 2022
b20b130
Fix server crash when updating the document with text array element.
jeevanchalke Mar 27, 2022
87a21c5
Fix server crash while updating/deleting with null _id value.
jeevanchalke Apr 28, 2022
255a83d
Add support for PostgreSQL 15 and EDB Postgres Advanced Server 15.
jeevanchalke Apr 28, 2022
19af3ca
Add some dummy startup and total default costs.
jeevanchalke May 18, 2022
7d38588
Refactor deparsing code in favor of upcoming aggregate push-down patc…
jeevanchalke May 18, 2022
46c37b7
Push down aggregates to remote MongoDB servers.
jeevanchalke May 18, 2022
fd37f1b
Add test coverage for the aggregate push-down.
jeevanchalke May 18, 2022
90ea7dc
Add enable_aggregate_pushdown option to control aggregate push-down.
jeevanchalke May 18, 2022
206f0b5
Add deprecation notice for the legacy driver in README and autogen.sh.
jeevanchalke May 18, 2022
c8b6cce
Run pgindent.
jeevanchalke May 18, 2022
3e2860b
Stamp 5.4.0.
jeevanchalke May 19, 2022
668124c
Fix typos in autogen.sh and README.md files.
jeevanchalke Jul 19, 2022
2cec9e4
Fix server crash caused due to missed Param node handling.
jeevanchalke Jul 19, 2022
a5b12ba
Improve the WHERE clause pushdown.
jeevanchalke Sep 6, 2022
637e4f6
Fix expected output changes for legacy code path.
jeevanchalke Sep 9, 2022
e10547f
Push down ORDER BY to remote MongoDB servers.
jeevanchalke Oct 13, 2022
8795246
Add test coverage for the ORDER BY push-down.
jeevanchalke Oct 13, 2022
2107388
Add enable_order_by_pushdown GUC to control ORDER BY push-down.
jeevanchalke Oct 13, 2022
58bce89
Push down LIMIT/OFFSET to remote MongoDB servers.
jeevanchalke Oct 13, 2022
0660759
Add test coverage for the LIMIT/OFFSET push-down.
jeevanchalke Oct 13, 2022
f1a6b44
Save the status of the enable_aggregate_pushdown option for later
jeevanchalke Oct 17, 2022
234c8cf
Check the shippability of sort clauses properly.
jeevanchalke Nov 29, 2022
d3f0e6c
Fix compilation warning.
jeevanchalke Dec 1, 2022
bcb22ac
Run pgindent.
jeevanchalke Dec 1, 2022
c250cbd
Stamp 5.5.0.
jeevanchalke Dec 14, 2022
830ba4a
Add enable_join_pushdown guc to control join push-down at the session…
jeevanchalke Mar 28, 2023
429e405
Remove support for v10.
jeevanchalke Mar 28, 2023
e62d0b2
Update EDB copyrights for 2023.
jeevanchalke Mar 28, 2023
e320b40
Add enable_aggregate_pushdown guc to control aggregate push-down.
jeevanchalke May 24, 2023
d5d8084
Add enable_order_by_pushdown option to control sort push-down.
jeevanchalke May 24, 2023
d742be9
Fix boolean expression handling in query document building.
jeevanchalke Jul 6, 2023
0919481
Add support for PostgreSQL 16 and EDB Postgres Advanced Server 16.
jeevanchalke Jul 6, 2023
bfc93f9
Add missing expected output files.
jeevanchalke Jul 7, 2023
d54d029
Fix warnings produced by -Wshadow=compatible-local
jeevanchalke Jul 7, 2023
4cdcfae
Update comments in README.md and test case files.
jeevanchalke Jul 7, 2023
9bfc78d
Stamp 5.5.1.
jeevanchalke Jul 14, 2023
c2d2b7e
Remove support for legacy drivers.
jeevanchalke Jan 4, 2024
373ea03
Refactor README.md file.
jeevanchalke Jan 4, 2024
9de8f0f
Tweak some tests to produce consistent output on various platforms.
jeevanchalke Jan 4, 2024
9a98959
Update EDB copyrights for 2024.
jeevanchalke Jan 4, 2024
2cfaa39
Update README with EDB's external documentation link.
jeevanchalke Apr 3, 2024
d07ef2d
Remove support for v11.
jeevanchalke Apr 3, 2024
11921b3
Add support for PostgreSQL 17 and EDB Postgres Advanced Server 17.
jeevanchalke Jun 24, 2024
5396a8b
Update README
jeevanchalke Jul 4, 2024
1236440
Stamp 5.5.2.
jeevanchalke Jul 11, 2024
f2c5c39
Support compiling from the contrib directory.
jeevanchalke Aug 22, 2024
d7bba7d
Fix compiler warnings showing up when compiled with flag -O2.
jeevanchalke Dec 20, 2024
6d5c2ea
Fix variable name in query pipeline used for sub-column.
jeevanchalke Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* whitespace=space-before-tab,trailing-space
*.[ch] whitespace=space-before-tab,trailing-space,indent-with-non-tab,tabwidth=4

# Avoid confusing ASCII underlines with leftover merge conflict markers
README conflict-marker-size=32
README.* conflict-marker-size=32

# Test output files that contain extra whitespace
*.out -whitespace
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# pgregress results directory
results/

.idea/
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "mongo-c-driver"]
path = mongo-c-driver
url = ../../mongodb/mongo-c-driver.git
[submodule "json-c"]
path = json-c
url = https://github.com/json-c/json-c.git
71 changes: 37 additions & 34 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
Contributing to `mongo_fdw`
===========================

Following these guidelines helps to facilitate relevant discussion in pull
requests and issues so the developers managing and developing this open source
project can address patches and bugs as efficiently as possible.
Following these guidelines helps to facilitate relevant discussion in
pull requests and issues so the developers managing and developing this
open source project can address patches and bugs as efficiently as
possible.


Using Issues
------------

`mongo_fdw`'s maintainers prefer that bug reports, feature requests, and pull
requests are submitted as [GitHub Issues][1]. If you think you require personal
assistance, please **do not** open an issue: email `engage` `@` `citusdata.com`
instead.
`mongo_fdw`'s maintainers prefer that bug reports, feature requests, and
pull requests are submitted as [GitHub Issues][1].


Bug Reports
Expand All @@ -21,20 +20,22 @@ Bug Reports
Before opening a bug report:

1. Search for a duplicate issue using GitHub's issue search
2. Check whethe the bug remains in the lasest `master` or `develop` commit
3. Create a reduced test case: remove code and data not relevant to the bug
2. Check whether the bug remains in the latest `master` or `develop`
commit
3. Create a reduced test case: remove code and data not relevant to
the bug

A contributor should be able to begin work on your bug without asking too many
followup questions. If you include the following information, your bug will be
serviced more quickly:
A contributor should be able to begin work on your bug without asking
too many followup questions. If you include the following information,
your bug will be serviced more quickly:

* Short, descriptive title
* Your OS
* Versions of dependencies
* Any custom modifications

Once the background information is out of the way, you are free to present the
bug itself. You should explain:
Once the background information is out of the way, you are free to
present the bug itself. You should explain:

* Steps you took to exercise the bug
* The expected outcome
Expand All @@ -44,42 +45,44 @@ bug itself. You should explain:
Feature Requests
----------------

We are open to adding features but ultimately control the scope and aims of the
project. If a proposed feature is likely to incur high testing, maintenance, or
performance costs it is also unlikely to be accepted. If a _strong_ case exists
for a given feature, we may be persuaded on merit. Be specific.
We are open to adding features but ultimately control the scope and aims
of the project. If a proposed feature is likely to incur high testing,
maintenance, or performance costs it is also unlikely to be accepted.
If a _strong_ case exists for a given feature, we may be persuaded on
merit. Be specific.


Pull Requests
-------------

Well-constructed pull requests are very welcome. By _well-constructed_, we mean
they do not introduce unrelated changes or break backwards compatibility. Just
fork this repo and open a request against `develop`.
Well-constructed pull requests are very welcome. By _well-constructed_,
we mean they do not introduce unrelated changes or break backwards
compatibility. Just fork this repo and open a request against `develop`.

Some examples of things likely to increase the likelihood a pull request is
rejected:
Some examples of things likely to increase the likelihood a pull request
is rejected:

* Large structural changes, including:
* Refactoring for its own sake
* Re-factoring for its own sake
* Adding languages to the project
* Unnecesary whitespace changes
* Unnecessary whitespace changes
* Deviation from obvious conventions
* Introduction of incompatible intellectual property

Please do not change version numbers in your pull request: they will be updated
by the project owners prior to the next release.
Please do not change version numbers in your pull request: they will be
updated by the project owners prior to the next release.


License
-------

By submitting a patch, you agree to allow the project owners to license your
work under the terms of the [`LICENSE`][2]. Additionally, you grant the project
owners a license under copyright covering your contribution to the extent
permitted by law. Finally, you confirm that you own said copyright, have the
legal authority to grant said license, and in doing so are not violating any
grant of rights you have made to third parties, including your employer.
By submitting a patch, you agree to allow the project owners to license
your work under the terms of the [`LICENSE`][2]. Additionally, you grant
the project owners a license under copyright covering your contribution
to the extent permitted by law. Finally, you confirm that you own said
copyright, have the legal authority to grant said license, and in doing
so are not violating any grant of rights you have made to third parties,
including your employer.

[1]: https://github.com/citusdata/mongo_fdw/issues
[1]: https://github.com/EnterpriseDB/mongo_fdw/issues
[2]: LICENSE
155 changes: 155 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
Notes about installation Mongo Foreign Data Wrapper
===================================================

To compile the [MongoDB][1] foreign data wrapper for [PostgreSQL](https://www.postgresql.org/), `mongo-c` and `json-c`
libraries are needed. To build and install `mongo-c` and `json-c` libraries, there
are two ways. You can either use script `autogen.sh` or you can manually
perform all required steps listed.

### Notes about new MongoDB C Driver support
The current implementation is based on the driver version 1.17.3 of MongoDB.

## Installation using script
Number of manual steps needs to be performed to compile and install required
mongo-c and json-c libraries. If you want to avoid the manual steps, there is a
shell script available which will download and install the appropriate drivers
and libraries for you.

Here is how it works:

To install mongo-c and json-c libraries at custom locations, you need to
export environment variables `MONGOC_INSTALL_DIR` and `JSONC_INSTALL_DIR`
respectively. If these variables are not set then these libraries will be
installed in the default location. Please note that you need to have the
required permissions on the directory where you want to install the libraries.

* autogen.sh

The script autogen.sh will do all the necessary steps to build with mongo-c
driver accordingly.

## Steps for manual installation
### mongo-c
1. Download and extract source code of mongoc driver for version `1.17.3`

```sh
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.17.3/mongo-c-driver-1.17.3.tar.gz
tar xzf mongo-c-driver-1.17.3.tar.gz
rm -rf mongo-c-driver
mv mongo-c-driver-1.17.3 mongo-c-driver
cd mongo-c-driver
```

2. Configure mongoc driver

```sh
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .
```

To install at custom location:

```sh
cmake -DCMAKE_INSTALL_PREFIX=YOUR_INSTALLATION_DIRECTORY -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .
```

3. Compile and install

```sh
cmake --build .
cmake --build . --target install
```

For more details on installation of mongo-c driver, you can refer [here][3].

### json-c

1. Download and extract source code

```sh
wget https://github.com/json-c/json-c/archive/json-c-0.15-20200726.tar.gz
tar -xzf json-c-0.15-20200726.tar.gz
rm -rf json-c
mv json-c-json-c-0.15-20200726/ json-c
cd json-c
```

2. Configure

```sh
cmake .
```
To install at custom location:

```sh
cmake -DCMAKE_INSTALL_PREFIX=YOUR_INSTALLATION_DIRECTORY .
```

3. Compile and install

```sh
make
make install
```

For more details on installation of json-c library, you can refer [here][4].

## Mongo_fdw configuration, compilation and installation
The `PKG_CONFIG_PATH` environment variable must be set to mongo-c-driver source
directory for successful compilation as shown below,

```sh
export PKG_CONFIG_PATH=$YOUR_MONGO_FDW_SOURCE_DIR/mongo-c-driver/src/libmongoc/src:$YOUR_MONGO_FDW_SOURCE_DIR/mongo-c-driver/src/libbson/src
```

The `LD_LIBRARY_PATH` environment variable must include the path to the mongo-c
installation directory containing the libmongoc-1.0.so and libbson-1.0.so
files. For example, assuming the installation directory is /home/mongo-c and
the libraries were created under it in lib64 sub-directory, then we can define
the `LD_LIBRARY_PATH` as:

```sh
export LD_LIBRARY_PATH=/home/mongo-c/lib64:$LD_LIBRARY_PATH
```

Note: This `LD_LIBRARY_PATH` environment variable setting must be in effect
when the `pg_ctl` utility is executed to start or restart PostgreSQL or
EDB Postgres Advanced Server.


1. To build on POSIX-compliant systems you need to ensure the
`pg_config` executable is in your path when you run `make`. This
executable is typically in your PostgreSQL installation's `bin`
directory. For example:

```sh
export PATH=/usr/local/pgsql/bin/:$PATH
```

2. Compile the code using make.

```sh
make USE_PGXS=1
```

3. Finally install the foreign data wrapper.

```sh
make USE_PGXS=1 install
```

4. Running regression test.

```sh
make USE_PGXS=1 installcheck
```
However, make sure to set the `MONGO_HOST`, `MONGO_PORT`, `MONGO_USER_NAME`,
and `MONGO_PWD` environment variables correctly. The default settings can be
found in the `mongodb_init.sh` script.


If you run into any issues, please [let us know][2].

[1]: http://www.mongodb.com
[2]: https://github.com/enterprisedb/mongo_fdw/issues/new
[3]: http://mongoc.org/libmongoc/1.17.3/installing.html#configuring-the-build
[4]: https://github.com/json-c/json-c/tree/json-c-0.15-20200726#build-instructions--
40 changes: 30 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# mongo_fdw/Makefile
#
# Copyright (c) 2012-2014 Citus Data, Inc.
# Portions Copyright (c) 2004-2024, EnterpriseDB Corporation.
# Portions Copyright © 2012–2014 Citus Data, Inc.
#

MODULE_big = mongo_fdw
Expand All @@ -10,21 +11,25 @@ MODULE_big = mongo_fdw
# on another platform, change env_posix.os in MONGO_OBJS with the appropriate
# environment object file.
#
LIBJSON = json-c
LIBJSON_OBJS = $(LIBJSON)/json_util.o $(LIBJSON)/json_object.o $(LIBJSON)/json_tokener.o \
$(LIBJSON)/json_object_iterator.o $(LIBJSON)/printbuf.o $(LIBJSON)/linkhash.o \
$(LIBJSON)/arraylist.o $(LIBJSON)/random_seed.o $(LIBJSON)/debug.o $(LIBJSON)/strerror_override.o

MONGO_DRIVER = mongo-c-driver-v0.6
MONGO_PATH = $(MONGO_DRIVER)/src
MONGO_OBJS = $(MONGO_PATH)/bson.os $(MONGO_PATH)/encoding.os $(MONGO_PATH)/md5.os \
$(MONGO_PATH)/mongo.os $(MONGO_PATH)/numbers.os $(MONGO_PATH)/env_posix.os
MONGO_INCLUDE = $(shell pkg-config --cflags libmongoc-1.0)
PG_CPPFLAGS = --std=c99 $(MONGO_INCLUDE) -I$(LIBJSON)
SHLIB_LINK = $(shell pkg-config --libs libmongoc-1.0)

OBJS = connection.o option.o mongo_wrapper.o mongo_fdw.o mongo_query.o deparse.o $(LIBJSON_OBJS)

PG_CPPFLAGS = --std=c99 -I$(MONGO_PATH)
OBJS = mongo_fdw.o mongo_query.o $(MONGO_OBJS)

EXTENSION = mongo_fdw
DATA = mongo_fdw--1.0.sql
DATA = mongo_fdw--1.0.sql mongo_fdw--1.1.sql mongo_fdw--1.0--1.1.sql

$(MONGO_DRIVER)/%.os:
$(MAKE) -C $(MONGO_DRIVER) $*.os
REGRESS = server_options connection_validation dml select pushdown join_pushdown aggregate_pushdown limit_offset_pushdown
REGRESS_OPTS = --load-extension=$(EXTENSION)

ifdef USE_PGXS
#
# Users need to specify their Postgres installation path through pg_config. For
# example: /usr/local/pgsql/bin/pg_config or /usr/lib/postgresql/9.1/bin/pg_config
Expand All @@ -33,3 +38,18 @@ $(MONGO_DRIVER)/%.os:
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

ifndef MAJORVERSION
MAJORVERSION := $(basename $(VERSION))
endif

ifeq (,$(findstring $(MAJORVERSION), 12 13 14 15 16 17))
$(error PostgreSQL 12, 13, 14, 15, 16, or 17 is required to compile this extension)
endif

else
subdir = contrib/mongo_fdw
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
Loading