-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
fix: Mark several functions as unsafe. #217
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ointers being passed in
eeeebbbbrrrr
changed the title
fix: Mark several functionbs as unsafe.
fix: Mark several functions as unsafe.
Sep 24, 2021
Merged
Hoverbear
added a commit
that referenced
this pull request
Sep 25, 2021
* wip: Update binary generator Signed-off-by: Ana Hobden <[email protected]> * wip: improvements from Sage Signed-off-by: Ana Hobden <[email protected]> * wip: slightly cursed generator placement Signed-off-by: Ana Hobden <[email protected]> * wip: better messages on generator checker Signed-off-by: Ana Hobden <[email protected]> * wip: sort inventory to achieve stable graph Signed-off-by: Ana Hobden <[email protected]> * wip: add example of desired macro Signed-off-by: Ana Hobden <[email protected]> * wip: get partial extension sql dependencies working Signed-off-by: Ana Hobden <[email protected]> * wip: cargo-fmt Signed-off-by: Ana Hobden <[email protected]> * wip: add missing files Signed-off-by: Ana Hobden <[email protected]> * wip: add control file for example Signed-off-by: Ana Hobden <[email protected]> * wip: correct some linkage Signed-off-by: Ana Hobden <[email protected]> * wip: format Signed-off-by: Ana Hobden <[email protected]> * wip: better bootstrap/finalize support Signed-off-by: Ana Hobden <[email protected]> * wip: bootstrap above schemas Signed-off-by: Ana Hobden <[email protected]> * wip: cleanup type registration Signed-off-by: Ana Hobden <[email protected]> * wip: improve structure some Signed-off-by: Ana Hobden <[email protected]> * wip: cleanup tests Signed-off-by: Ana Hobden <[email protected]> * wip: improve dot and verbose on cargo pgx schema Signed-off-by: Ana Hobden <[email protected]> * wip: support trace Signed-off-by: Ana Hobden <[email protected]> * wip: fix return arrow direction Signed-off-by: Ana Hobden <[email protected]> * wip: fix dot default Signed-off-by: Ana Hobden <[email protected]> * wip: better errors on unknown types Signed-off-by: Ana Hobden <[email protected]> * Don't look up the type oid for types that never use it 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. * wip: handle inner impl trait on box and option Signed-off-by: Ana Hobden <[email protected]> * wip: Support PgBox Signed-off-by: Ana Hobden <[email protected]> * wip: resolve some lifetime issues with fn args Signed-off-by: Ana Hobden <[email protected]> * wip: resolve schema and name aliasing issues Signed-off-by: Ana Hobden <[email protected]> * wip: uncomment test Signed-off-by: Ana Hobden <[email protected]> * fmt Signed-off-by: Ana Hobden <[email protected]> * wip: Support variadic Signed-off-by: Ana Hobden <[email protected]> * wip: schema resolution a bit more strict Signed-off-by: Ana Hobden <[email protected]> * Don't run all tests in cargo pgx test In a workspace this will run non-extension tests as well which is inconsistent with `cargo test`. The old behavior can be recovered with the new `--workspace` flag. * wip: ord/hash linkage Signed-off-by: Ana Hobden <[email protected]> * wip: fix duplicated module magic Signed-off-by: Ana Hobden <[email protected]> * wip: handle non-existing sql dir Signed-off-by: Ana Hobden <[email protected]> * wip: ignore some tests Signed-off-by: Ana Hobden <[email protected]> * wip: fix errror example Signed-off-by: Ana Hobden <[email protected]> * wip: use old bindings Signed-off-by: Ana Hobden <[email protected]> * wip: fixups Signed-off-by: Ana Hobden <[email protected]> * wip: add some docs Signed-off-by: Ana Hobden <[email protected]> * chore: some cleaning and docs Signed-off-by: Ana Hobden <[email protected]> * chore: move around From/Intos Signed-off-by: Ana Hobden <[email protected]> * chore: more idiomatic structuring of pg_inventory Signed-off-by: Ana Hobden <[email protected]> * chore: create ToSql Signed-off-by: Ana Hobden <[email protected]> * chore: some tidying on pg_inventory Signed-off-by: Ana Hobden <[email protected]> * chore: rearrange some things: Signed-off-by: Ana Hobden <[email protected]> * chore: introduce build_base_edges Signed-off-by: Ana Hobden <[email protected]> * chore: fmt Signed-off-by: Ana Hobden <[email protected]> * chore: we can use a HashSet Signed-off-by: Ana Hobden <[email protected]> * feat: introduce skip_inventory attribute in certain places Signed-off-by: Ana Hobden <[email protected]> * chore: document skip_inventory Signed-off-by: Ana Hobden <[email protected]> * chore: fmt Signed-off-by: Ana Hobden <[email protected]> * chore: enable skip_inventory on all Signed-off-by: Ana Hobden <[email protected]> * chore: add functional doctests for several derives Signed-off-by: Ana Hobden <[email protected]> * chore: add some docs to pg_inventory Signed-off-by: Ana Hobden <[email protected]> * chore: functional test for PostgresEnum Signed-off-by: Ana Hobden <[email protected]> * chore: add functional test for PostgresType Signed-off-by: Ana Hobden <[email protected]> * chore: functional tests for PostgresOrd and PostgresHash Signed-off-by: Ana Hobden <[email protected]> * Added support for uuid PostgreSQL type * Added formatting for Uuid type, compatible with PostgreSQL uuid_out result * chore: update docs Signed-off-by: Ana Hobden <[email protected]> * chore: fix some documentation Signed-off-by: Ana Hobden <[email protected]> * chore: add pg_extern test Signed-off-by: Ana Hobden <[email protected]> * Added Uuid::as_bytes to allow conversion from pgx::Uuid to uuid::Uuid if necessary * feat: initial 'creates' syntax for extension_sql Signed-off-by: Ana Hobden <[email protected]> * feat: extension_sql creates don't need pgbox, option, etc Signed-off-by: Ana Hobden <[email protected]> * feat: infer module paths for extension_sql creates Signed-off-by: Ana Hobden <[email protected]> * chore: fixup struct tests Signed-off-by: Ana Hobden <[email protected]> * chore: fmt Signed-off-by: Ana Hobden <[email protected]> * chore: cleanup PgxSql::build Signed-off-by: Ana Hobden <[email protected]> * chore: clean up logs some Signed-off-by: Ana Hobden <[email protected]> * chore: get inventory items parsing even when skipped Signed-off-by: Ana Hobden <[email protected]> * chore: Add a creates doc Signed-off-by: Ana Hobden <[email protected]> * chore: fix some comments Signed-off-by: Ana Hobden <[email protected]> * chore: Use block doc comments in some long places Signed-off-by: Ana Hobden <[email protected]> * chore: add pgx.control Signed-off-by: Ana Hobden <[email protected]> * chore: improve note about overrides Signed-off-by: Ana Hobden <[email protected]> * chore: patch variadic positioning Signed-off-by: Ana Hobden <[email protected]> * chore: use old pgx-pg-sys Signed-off-by: Ana Hobden <[email protected]> * chore: improve default sql path consistency Signed-off-by: Ana Hobden <[email protected]> * feat: let pgx schema take a pg11/12 etc param Signed-off-by: Ana Hobden <[email protected]> * chore: fixup schema arg req Signed-off-by: Ana Hobden <[email protected]> * chore: fmt Signed-off-by: Ana Hobden <[email protected]> * feat: remove need for pgx-utils or pgx-macros in user crates Signed-off-by: Ana Hobden <[email protected]> * chore: once again reset pg sys bindings Signed-off-by: Ana Hobden <[email protected]> * chore: fixup some stray pgx-utils imports Signed-off-by: Ana Hobden <[email protected]> * chore: clear out remaining pgx-utils needs for inventory Signed-off-by: Ana Hobden <[email protected]> * chore: improve some documentation Signed-off-by: Ana Hobden <[email protected]> * chore: once again reset pgx-pg-sys Signed-off-by: Ana Hobden <[email protected]> * feat: functional custom_sql test Signed-off-by: Ana Hobden <[email protected]> * wip: cleaning Signed-off-by: Ana Hobden <[email protected]> * chore: handle default inside option Signed-off-by: Ana Hobden <[email protected]> * feat: support Oid Signed-off-by: Ana Hobden <[email protected]> * feat: Oids in returns too Signed-off-by: Ana Hobden <[email protected]> * feat: partially support Box<dyn Iterator> Signed-off-by: Ana Hobden <[email protected]> * feat: finish Box<dyn Iterator>> support Signed-off-by: Ana Hobden <[email protected]> * chore: remove stray test Signed-off-by: Ana Hobden <[email protected]> * chore: fix handling of Oid in named Signed-off-by: Ana Hobden <[email protected]> * chore: add custom_sql to github actions Signed-off-by: Ana Hobden <[email protected]> * chore: workaround Rust 1.54/Inventory issue Signed-off-by: Ana Hobden <[email protected]> * chore: remove generated sqls Signed-off-by: Ana Hobden <[email protected]> * feat: extra annotations on extension_sql output Signed-off-by: Ana Hobden <[email protected]> * chore: support default with f64 Signed-off-by: Ana Hobden <[email protected]> * chore: support bool in default Signed-off-by: Ana Hobden <[email protected]> * chore: strip debugging symbol Signed-off-by: Ana Hobden <[email protected]> * wip: checkpoint a new method supporting incremental compilation Signed-off-by: Ana Hobden <[email protected]> * wip: get links exposed in binary Signed-off-by: Ana Hobden <[email protected]> * wip: get symbols passing Signed-off-by: Ana Hobden <[email protected]> * wip: get custom_types example working Signed-off-by: Ana Hobden <[email protected]> * wip: make linker script more defined Signed-off-by: Ana Hobden <[email protected]> * wip: cleanup cargo lock Signed-off-by: Ana Hobden <[email protected]> * wip: update flake lock Signed-off-by: Ana Hobden <[email protected]> * wip: support arm Signed-off-by: Ana Hobden <[email protected]> * feat: clean up new sql generation method Signed-off-by: Ana Hobden <[email protected]> * chore: fixup extern ident fn Signed-off-by: Ana Hobden <[email protected]> * chore: handle duplicated schema names Signed-off-by: Ana Hobden <[email protected]> * chore: cleanup cargo pgx schema output Signed-off-by: Ana Hobden <[email protected]> * chore: return to proper typeids Signed-off-by: Ana Hobden <[email protected]> * chore: remove some cruft Signed-off-by: Ana Hobden <[email protected]> * feat: let cargo pgx schema work quieter Signed-off-by: Ana Hobden <[email protected]> * chore: repair cargo settings on examples Signed-off-by: Ana Hobden <[email protected]> * chore: cleanup imports Signed-off-by: Ana Hobden <[email protected]> * chore: improve formatting and output Signed-off-by: Ana Hobden <[email protected]> * chore: use feature flag in pgx-tests Signed-off-by: Ana Hobden <[email protected]> * chore: fixup tests Signed-off-by: Ana Hobden <[email protected]> * chore: update help Signed-off-by: Ana Hobden <[email protected]> * chore: use requires instead of before/after Signed-off-by: Ana Hobden <[email protected]> * chore: fixup tests Signed-off-by: Ana Hobden <[email protected]> * chore: remove skip_inventory Signed-off-by: Ana Hobden <[email protected]> * feat: suport requires in pg_extern Signed-off-by: Ana Hobden <[email protected]> * chore: cleanup requires code Signed-off-by: Ana Hobden <[email protected]> * chore: color a log Signed-off-by: Ana Hobden <[email protected]> * chore: improve positioning ref resolution Signed-off-by: Ana Hobden <[email protected]> * chore: docs Signed-off-by: Ana Hobden <[email protected]> * chore: support variadic!() Signed-off-by: Ana Hobden <[email protected]> * chore: improve requires resolution Signed-off-by: Ana Hobden <[email protected]> * chore: make graph stable Signed-off-by: Ana Hobden <[email protected]> * chore: fixup an extension_sql issue Signed-off-by: Ana Hobden <[email protected]> * chore: use correct pgx_marker location Signed-off-by: Ana Hobden <[email protected]> * chore: cleanup marker Signed-off-by: Ana Hobden <[email protected]> * chore: docs around marker Signed-off-by: Ana Hobden <[email protected]> * feat: better cargo-pgx output Signed-off-by: Ana Hobden <[email protected]> * chore: fix feature flag Signed-off-by: Ana Hobden <[email protected]> * chore: cleanup pgx schema output Signed-off-by: Ana Hobden <[email protected]> * chore: support requires schemas Signed-off-by: Ana Hobden <[email protected]> * chore: improve schema positioning resolution Signed-off-by: Ana Hobden <[email protected]> * chore: rename pgx-linker-script.sh Signed-off-by: Ana Hobden <[email protected]> * chore: fmt Signed-off-by: Ana Hobden <[email protected]> * chore: update flake lock Signed-off-by: Ana Hobden <[email protected]> * chore: add pg_schema docs Signed-off-by: Ana Hobden <[email protected]> * chore: improve some docs Signed-off-by: Ana Hobden <[email protected]> * chore: tidy some error conditions Signed-off-by: Ana Hobden <[email protected]> * chore: clean some docs Signed-off-by: Ana Hobden <[email protected]> * chore: some docs Signed-off-by: Ana Hobden <[email protected]> * chore: doc tests Signed-off-by: Ana Hobden <[email protected]> * chore: repair an example Signed-off-by: Ana Hobden <[email protected]> * chore: fix schemas example Signed-off-by: Ana Hobden <[email protected]> * chore: improve format Signed-off-by: Ana Hobden <[email protected]> * fix: repair docsrs build Signed-off-by: Ana Hobden <[email protected]> * feat: support testname in cargo pgx test Signed-off-by: Ana Hobden <[email protected]> * Update cargo-pgx/src/commands/test.rs * chore: cleanup formatting Signed-off-by: Ana Hobden <[email protected]> * chore: update README.md Signed-off-by: Ana Hobden <[email protected]> * chore: add cargo pgx schema -o docs Signed-off-by: Ana Hobden <[email protected]> * chore: fixup comments Signed-off-by: Ana Hobden <[email protected]> * feat: add aggregate example Signed-off-by: Ana Hobden <[email protected]> * chore: fix messed up merge conflict resolution It has been zero days since I forgot to hit save in VSCode and commited it. * feat: migrate aggregate example to PgVarlena Signed-off-by: Ana Hobden <[email protected]> * chore: fixup doc links Signed-off-by: Ana Hobden <[email protected]> * chore: update dependencies Signed-off-by: Ana Hobden <[email protected]> * chore: fmt Signed-off-by: Ana Hobden <[email protected]> * chore: fmt Signed-off-by: Ana Hobden <[email protected]> * chore: document pgx::info and related macros more Signed-off-by: Ana Hobden <[email protected]> * chore: fix shmem example Signed-off-by: Ana Hobden <[email protected]> * chore: fix doc tests Signed-off-by: Ana Hobden <[email protected]> * chore: fixups Signed-off-by: Ana Hobden <[email protected]> * chore: how to update cargo-pgx, not pgx Signed-off-by: Ana Hobden <[email protected]> * chore: use pg10 compat syntax Signed-off-by: Ana Hobden <[email protected]> * chore: add example to ci Signed-off-by: Ana Hobden <[email protected]> * chore: cleanup imports Signed-off-by: Ana Hobden <[email protected]> * chore: make trigger test functional Signed-off-by: Ana Hobden <[email protected]> * chore: suggest rustfmt install when not found Signed-off-by: Ana Hobden <[email protected]> * chore: format Signed-off-by: Ana Hobden <[email protected]> * chore: move info to readme Signed-off-by: Ana Hobden <[email protected]> * chore: support -vvvvvvvv Signed-off-by: Ana Hobden <[email protected]> * chore: better example content Signed-off-by: Ana Hobden <[email protected]> * chore: remove stale finfo fns Signed-off-by: Ana Hobden <[email protected]> * chore: improve readme Signed-off-by: Ana Hobden <[email protected]> * chore: remove sql Signed-off-by: Ana Hobden <[email protected]> * chore: add freebsd, tweak gitignore Signed-off-by: Ana Hobden <[email protected]> * chore: format Signed-off-by: Ana Hobden <[email protected]> * chore: remove more generated SQL Signed-off-by: Ana Hobden <[email protected]> * chore: rename inventory stuff Signed-off-by: Ana Hobden <[email protected]> * chore: fix some renames Signed-off-by: Ana Hobden <[email protected]> * chore: correct cargo pgx package help Signed-off-by: Ana Hobden <[email protected]> * chore: fix 'Stopping' alignment Signed-off-by: Ana Hobden <[email protected]> * chore: format Signed-off-by: Ana Hobden <[email protected]> * chore: remove unused dependency Signed-off-by: Ana Hobden <[email protected]> * chore: correct a non-error Signed-off-by: Ana Hobden <[email protected]> * feat: enable new SQL generator on Mac Signed-off-by: Ana Hobden <[email protected]> * chore: update README.md Signed-off-by: Ana Hobden <[email protected]> * chore: newline fixes Signed-off-by: Ana Hobden <[email protected]> * - use `uname` to detect which operating system we're compiling on. - for MacOS, the `-exported_symbols_list` doesn't want `=` to set its argument * this file is no longer necessary * `#[link(kind = "static")]` is not necessary * when building the sql-generator binary, we don't need the `-Wl,-undefined,dynamic_lookup` bit. We only need this for building the .so. * chore: improve error passing slightly Signed-off-by: Ana Hobden <[email protected]> * chore: improve cargo new to work Signed-off-by: Ana Hobden <[email protected]> * fix(develop): use thinlto in debug Signed-off-by: Ana Hobden <[email protected]> * chore: cleanup aggregate example Signed-off-by: Ana Hobden <[email protected]> * chore: fixup template Signed-off-by: Ana Hobden <[email protected]> * chore: fix merge mistake Signed-off-by: Ana Hobden <[email protected]> * chore: reduce UB in public API Signed-off-by: Ana Hobden <[email protected]> * fix: reduce UB in public API Signed-off-by: Ana Hobden <[email protected]> * Articles (#198) * 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]> * fix: Mark several functions as unsafe. (#217) * 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]> * chore: fix some docs links (#219) Signed-off-by: Ana Hobden <[email protected]> * release: 0.2.0-beta.0 (#218) Signed-off-by: Ana Hobden <[email protected]> * fix: mark called_as_trigger as unsafe (#223) * fix: Mark PgTupleDesk::from_pg_copy unsafe (#224) Signed-off-by: Ana Hobden <[email protected]> * fix: mark get_getarg_type unsafe (#226) Signed-off-by: Ana Hobden <[email protected]> * chore: update pgx-pg-sys default bindings Signed-off-by: Ana Hobden <[email protected]> Co-authored-by: Joshua Lockerman <[email protected]> Co-authored-by: Dmytro Shteflyuk <[email protected]> Co-authored-by: Eric B. Ridge <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We can't guarantee the being passed in. :(
See #216 #210 #215 for more.