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

Document minimum stable Rust version (fixes #155) #157

Merged
merged 4 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

`pgx` supports Postgres v10, v11, v12, and v13.

Feel free to join our [Discord Server](https://discord.gg/hPb93Y9).
**Feel free to join our [Discord Server](https://discord.gg/hPb93Y9).**

## Key Features

Expand Down Expand Up @@ -114,13 +114,16 @@ custom types.

## System Requirements

- `cargo install rustfmt`
- `rustc` (minimum version 1.52) and `cargo`
- `cargo install rustfmt`
- `git`
- `libclang.so`
- Ubuntu: `libclang-dev` or `clang`
- RHEL: `clang`
- [build dependencies for PostgreSQL](https://wiki.postgresql.org/wiki/Compile_and_Install_from_source_code)

Note that a local Postgres installation is not required. `pgx` will download and compile Postgres itself.

## Getting Started

### 1. Install `cargo-pgx`
Expand Down Expand Up @@ -181,22 +184,35 @@ The first time, compilation takes a few minutes as `pgx` needs to generate almos
Postgres' header files.

Once compiled you'll be placed in a `psql` shell, for, in this case, Postgres 13.
Now, we can just [load the extension](https://www.postgresql.org/docs/13/sql-createextension.html) and do a select on the example function.

```sql
CREATE EXTENSION my_extension;
SELECT hello_my_extension();
```
Now, we can [load the extension](https://www.postgresql.org/docs/13/sql-createextension.html) and do a SELECT on the example function.

This will return something along the lines of
```console
my_extension=# CREATE EXTENSION my_extension;
CREATE EXTENSION

```
my_extension=# SELECT hello_my_extension();
hello_my_extension
---------------------
Hello, my_extension
(1 row)
```


## Upgrading

You can upgrade your current `cargo-pgx` installation by passing the `--force` flag
to `cargo install`:

```shell script
$ cargo install --force cargo-pgx
```

As new Postgres versions are supported by `pgx`, you can re-run the `pgx init` process to download and compile them:

```shell script
$ cargo pgx init
```

## Digging Deeper

- [cargo-pgx sub-command](cargo-pgx/)
Expand Down
2 changes: 1 addition & 1 deletion pgx-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::collections::HashSet;
use syn::spanned::Spanned;
use syn::{parse_macro_input, Attribute, Data, DeriveInput, Item, ItemFn};

/// Declare a function as `#[pg_guard]` to indcate that it is called from a Postgres `extern "C"`
/// Declare a function as `#[pg_guard]` to indicate that it is called from a Postgres `extern "C"`
/// function so that Rust `panic!()`s (and Postgres `elog(ERROR)`s) will be properly handled by `pgx`
#[proc_macro_attribute]
pub fn pg_guard(_attr: TokenStream, item: TokenStream) -> TokenStream {
Expand Down