Comments (12)
I think the following solution would looks quite sexy:
- a dependency for postgres-embedded (without extensions) <- what we have actually
- add the possibility to detect other dependencies: another dependency which contains postgis-postgres-embedded-extension <-- and if it is present via reflection we copy some parts of it into the postgres embedded somehow ?
If we could reach such things that would be very flexible and allow anybody to create new extensions for pg-embedded without impacting it :)
@stevenschlansker I would be happy to contribute on this feature part if you want. (at least provide you some help if I can)
from otj-pg-embedded.
plv8 would be useful as well
from otj-pg-embedded.
We could add the ability to unpack another tarball on top of the base postgres installation, and then the extension initialization can run through the current DatabasePreparer
interface. Would that be sufficient? Or you can provide a whole postgres with custom libraries.
from otj-pg-embedded.
Any dev thoughts on @tatut's suggestion or any other method to add extensions to pg-embedded? Such a solution would make pg-embedded much more useful.
from otj-pg-embedded.
That's something we would like to support. I haven't tried postgis
personally since before I started this project but any help on figuring out what needs to be done would be much appreciated!
from otj-pg-embedded.
My understanding is that extensions are simply shared object files in the library directory.
I took a look around my project's docker db (pg 9.5 + postgis 2.2) and postgis extension is at:
/usr/lib/postgresql/9.5/lib/postgis_topology-2.2.so
/usr/lib/postgresql/9.5/lib/postgis-2.2.so
/usr/lib/postgresql/9.5/lib/rtpostgis-2.2.so
Also support files seem to be under /usr/share/postgresql/9.5/extension/ which has a bunch of postgis--<version>.sql
files which are loaded when the extension is created and a postgis.control
which has the following content:
# postgis extension
comment = 'PostGIS geometry, geography, and raster spatial types and functions'
default_version = '2.2.1'
module_pathname = '$libdir/postgis-2.2'
relocatable = true
Other extensions seem to follow the same pattern: a .control and .sql files in the extension folder and a shared object in to lib directory.
Perhaps pg-embedded could simply provide an extension hook that calls some code with the libdir and extension dir as parameters prior to starting the embedded server binary? That should make it possible to bring your own extensions.
from otj-pg-embedded.
Something along the lines of:
class Extender implements PgExtender {
public void beforeStart(String system, String machineHardware, File libraryDir, File extensionDir) throws IOException {
/* Code to copy system/hardware specific shared objects to library directory
and common .control and .sql files to extension directory */
}
}
EmbeddedPostgreSQL
.builder()
.setPgExtender(new Extender())
.start();
from otj-pg-embedded.
@stevenschlansker We've created the postgis extension for windows distribution: https://github.com/IDgis/otj-pg-embedded to be used locally. There is no gradle/maven dependency yet.
Maybe something to add as a default, because it's very useful for us and a much better way than to have h2 mock a postgres database with postgis extension.
from otj-pg-embedded.
Just side info. Another handy extension is also timescaledb. Also starlingbank have forked this project with one interesting commit. Given commit adds pgtap extension.
from otj-pg-embedded.
Is this also related to pg_trgm extension? I'm trying to run CREATE EXTENSION IF NOT EXISTS pg_trgm
before starting my unit tests but it fails.
from otj-pg-embedded.
So is PostGIS supported now? Or can someone suggest a valid solution for use in tests?
from otj-pg-embedded.
@Panic7 I had success moving to https://github.com/testcontainers/testcontainers-java which are more finnicky to set up in CI but ultimately more extensible
from otj-pg-embedded.
Related Issues (20)
- IllegalStateException HOT 2
- No Postgres binary found for Darwin / aarch64 (Apple M1) HOT 2
- Lib not found HOT 3
- Snyk reports license warning for spotbugs-annotation dependency HOT 1
- Cannot resolve com.opentable.components:otj-spring:5.2.1 HOT 2
- Corrupted charsets in console HOT 1
- Catchpoint blog migration HOT 1
- Installed `postgres` binary is throwing segmentation fault on macOS 12.0 HOT 11
- Not working since upgrate to macOS 12 Monterey HOT 14
- PG Embedded - the Future (Update: 1.x now released) HOT 13
- M1 is not supported from the box HOT 2
- Cannot connect to database from other processes since 1.0.0 HOT 8
- The project README.md appears to have an incomplete statement HOT 3
- CurrVal function returns null in Postgres embedded db HOT 4
- Failed to build on Jenkins(docker refuses connection) HOT 3
- Unable to start postgresql on my machine HOT 2
- Can not connect to Ryuk at localhost:49163 HOT 1
- Docker environment failed issue HOT 3
- Darwin aarch64 support without Testcontainers HOT 1
- Java 8 compatibility HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from otj-pg-embedded.