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

release: 0.2.0-beta.0 #221

Merged
merged 343 commits into from
Sep 25, 2021
Merged

release: 0.2.0-beta.0 #221

merged 343 commits into from
Sep 25, 2021

Conversation

Hoverbear
Copy link
Contributor

@Hoverbear Hoverbear commented Sep 24, 2021

Features

Other changes

Migration Guide

  1. Update your cargo-pgx: cargo install --force cargo-pgx --version 0.2.0-beta.0

  2. In your Cargo.toml, set crate-type to include "rlib" and profile.dev.lto to be "thin":

    [lib]
    crate-type = ["cdylib", "rlib"]
    
    [profile.dev]
    lto = "thin"
  3. Tell cargo-pgx to force update your .cargo/ and src/bin files it needs: cargo pgx schema -f

  4. Remove any sql/*.generated.sql files, as well as the load-order.txt.

  5. For each sql/*.sql remaining, insert extension_sql_file!("../sql/that_file.sql"); into your src/lib.rs

  6. If the files depend on entities which already exist, you might need to set a requires attribute:

    extension_sql_file!("../sql/that_file.sql", requires = [ dogs::parts::Floof, some_fn, ]);
  7. For any mod floof { fn boop() { todo!() } } style blocks you were using to infer schema name (making that function floof.boop), decorate the schema with #[pg_schema]:

    #[pg_schema]
    mod floof {
        fn boop() {
            todo!()
        }
    }
  8. For any functions have a custom sql block for (like below), update that to use pgxsql now:

    /// ```sql <-- Change this to `pgxsql`
    /// CREATE OR REPLACE FUNCTION  ....
    /// ```
    #[pg_extern]
    fn dot_dot_dot() { todo!() }
  9. Run cargo pgx schema again!

If you have any trouble, try running cargo pgx schema -v and investigating the output. We made sure to update the cargo doc output of pgx with updated usage for the various macros and derives, they might have some advice, too.

You can ask us questions via issues here or Discord if you get stuck.

Thanks!

Thanks to @JLockerman (from @timescale) & @kpumuk for contributions! Also thanks to our early testers @rustprooflabs and @comdiv.

Hoverbear and others added 30 commits July 8, 2021 11:54
Signed-off-by: Ana Hobden <[email protected]>
Signed-off-by: Ana Hobden <[email protected]>
Signed-off-by: Ana Hobden <[email protected]>
Signed-off-by: Ana Hobden <[email protected]>
Signed-off-by: Ana Hobden <[email protected]>
Signed-off-by: Ana Hobden <[email protected]>
Signed-off-by: Ana Hobden <[email protected]>
Getting function argument type oids can be surprisingly expensive; one
Promscale benchmark measures it as taking over 10% of runtime.
Fortunately, most types do not actually make use of this information,
and the `getarg_type()` call can be optimized out if this fact is
known. This commit adds an opt-in method for declaring that a type does
not make use of the `typeoid` in `from_datum()`, and updates
`pg_getarg()` to make use of this information.

This commit makes the following changes:
 1. It adds a `const` boolean to `FromDatum` called `NEEDS_TYPID`. This
    boolean is defaulted to `true`. Types that never use the `typeoid`
    parameter to `from_datum()` can override this to `false`.
 2. `pg_getarg()` updated to look at `T::NEEDS_TYPID` before calling
    `get_getarg_type()`. If `T::NEEDS_TYPID == true` it calls
    `get_getarg_type()` like it currently does for all types; if it is
    `false` it instead passes `InvalidOid` as the (unused) `typeoid`
    argument to `from_datum()`.
 3. It edits a number of built in types to make use of this
    optimization.

Since this feature is both opt-in and backwards compatible, it should
not break any downstream users.
Signed-off-by: Ana Hobden <[email protected]>
Signed-off-by: Ana Hobden <[email protected]>
Signed-off-by: Ana Hobden <[email protected]>
Signed-off-by: Ana Hobden <[email protected]>
eeeebbbbrrrr and others added 23 commits September 21, 2021 12:52
- for MacOS, the `-exported_symbols_list` doesn't want `=` to set its argument
…ined,dynamic_lookup` bit.

We only need this for building the .so.
Signed-off-by: Ana Hobden <[email protected]>
Use thin lto in debug to ensure symbols are properly exported.
Signed-off-by: Ana Hobden <[email protected]>
fix: attempt repair docsrs build
chore: reduce UB in public API
* chore: add articles page

Signed-off-by: Ana Hobden <[email protected]>

* chore: add clarifying 'a'

Signed-off-by: Ana Hobden <[email protected]>

* chore: add date comment

Signed-off-by: Ana Hobden <[email protected]>

* chore: add another article!

Signed-off-by: Ana Hobden <[email protected]>

* chore: add video link

Signed-off-by: Ana Hobden <[email protected]>

* chore: Update some article contents

Signed-off-by: Ana Hobden <[email protected]>

* chore: remove TODO link

Signed-off-by: Ana Hobden <[email protected]>
* set a number of functions as unsafe, because we can't guarantee the pointers being passed in

* fix doctest

Co-authored-by: Eric B. Ridge <[email protected]>
@Hoverbear Hoverbear self-assigned this Sep 24, 2021
@Hoverbear Hoverbear merged commit 8a860a5 into master Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants