Closed zombodb closed 4 years ago
Notes to self:
PGX_BUILD_FLAGS
envar for cargo pgx install/test
(and likely package too)PGX_HOME
envar for using a directory other than ~/.pgx/
rustfmt
crate when formatting our post-processed bindings.rs files, instead of shelling out to the CLI. Eliminates a system dependency.~ -- looks like that's not a thing?This is all coming along nicely. Here's a little screenshot of using some of these new cargo pgx
commands. Please pardon the type-o in the middle!
Awesome work! I was fighting with pgx install but this is really what's needed to make the workflow better. Have you guys considered a docker based workflow? I used dockerized postgres instances for development and works like a charm.I could help adding the support on pgx if that's something of interest.
Hey @diegopy! Thanks for this comment. We're working really hard to make cargo pgx
better. We kinda missed the boat on this initial release. But we ain't afraid to admit it.
I just wrapped up a 1h 45m twitch stream showing off the work we've done on this issue (https://www.twitch.tv/videos/682684142). When you get bored, watch it (FF through the first 10mins or so).
Regarding Docker ... you're not the first person to suggest that. Once this issue is resolved, I think it might make sense to talk about it.
At some point, it seems to me that if you choose to use pgx
, you've decided to become a PG developer. And with that comes some stress and responsibility. That said, if we can make all that disappear, I'm down!
Okay, I think I'm done with all of this.
Soon as one of these stupid GitHub Action test workflows that take way too long finishes with success, I'm going to merge. And start the process to publish a new release.
released to crates.io
build.rs
no longer downloads/compiles postgres. It'll instead be limited to generating the "bindgen" bindings for each version and compiling pgx's "cshim" static library (this'll be difficult to resolve for Windows users, I think)cargo pgx init
comes to life and it does the dowload/compile Postgres versions dance (in parallel) into~/.pgx/
, or it can use any/all Postgres versions you might already have installed on your computer, specified via args tocargo pgx init
. Paths to each version'spg_config
will be saved in~/.pgx/config.toml
.cargo pgx install
stays, and continues to simply compile/install the extension to the Postgres instance specified by whateverpg_config
binary is currently on the$PATH
cargo pgx start PG_VER
comes to life to start a pg instance, specific topgx
cargo pgx stop PG_VER
comes to life to stop a pg instance, specific topgx
cargo pgx status [pg_ver]
comes to life to see what's up with a pg instance, specific topgx
cargo pgx run PG_VER [dbname]
comes to life and it compiles/installs the extension to the PG instance described in~/.pgx/config.toml
and starts it (if not already running) and immediately pops you intopsql
connected to the specified database (if unspecified, the dbname will be the extension name, creating it if necessary).caro pgx test [pg_ver]
stays, but will spin up a temporary Postgres instance using what~/.pgx/config.toml
points tocargo pgx package
builds (at least) a directory structure intarget/
that can be manually (for now) turned into a tarball/deb/rpmIn the case of using Postgres instances already installed on your computer (likely through your OS' package manager) you'll need write access to the directories from
pg_config --pkglibdir
andpg_config --sharedir
. You'll be on your own to sort that out.I think maybe the typical workflow here is that you'll have one primary version of Postgres installed (via apt/dnf/brew/whatever), and then
cargo pgx init
will manage the other two. So for example, you might first invokecargo pgx init
like so:At this point,
cargo pgx init
will only download/compile/install PG10 and PG11.There'll be system requirements on (at least)
Additionally, the Postgres versions that
cargo pgx init
does compile itself will have'--enable-debug' '--enable-cassert'
turned on so that in the case of core dumps, they can be debugged with gdb/lldb.