Skip to content
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
2 changes: 1 addition & 1 deletion cargo-pgrx/src/command/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl CommandExecute for Info {
}
}

fn version(ver: &str) -> Cow<str> {
fn version(ver: &str) -> Cow<'_, str> {
if ver.starts_with("pg") {
Cow::Borrowed(ver)
} else {
Expand Down
2 changes: 1 addition & 1 deletion cargo-pgrx/src/command/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ fn compute_sql(package_name: &str, manifest: &Manifest) -> eyre::Result<()> {
Ok(())
}

fn parse_object(data: &[u8]) -> object::Result<object::File> {
fn parse_object(data: &[u8]) -> object::Result<object::File<'_>> {
let kind = object::FileKind::parse(data)?;

match kind {
Expand Down
2 changes: 1 addition & 1 deletion cargo-pgrx/src/templates/lib_rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use pgrx::prelude::*;

::pgrx::pg_module_magic!(c"{name}", pgrx::pg_sys::PG_VERSION);
::pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn hello_{name}() -> &'static str {{
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/aggregate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use pgrx::StringInfo;
use serde::{Deserialize, Serialize};
use std::str::FromStr;

pgrx::pg_module_magic!(c"aggregate", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[derive(Copy, Clone, PostgresType, Serialize, Deserialize)]
#[pgvarlena_inoutfuncs]
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/arrays/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use pgrx::prelude::*;
use serde::*;

pgrx::pg_module_magic!(c"arrays", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn sq_euclid_pgrx(a: Array<f32>, b: Array<f32>) -> f32 {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/bad_ideas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::io::{Read, Write};
use std::panic::catch_unwind;
use std::process::Command;

pgrx::pg_module_magic!(c"bad_ideas", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn panic(s: &str) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/bgworker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::time::Duration;
this background worker
*/

pgrx::pg_module_magic!(c"bgworker", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_guard]
pub extern "C-unwind" fn _PG_init() {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/bytea/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use libflate::gzip::{Decoder, Encoder};
use pgrx::prelude::*;
use std::io::{Read, Write};

pgrx::pg_module_magic!(c"bytea", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

/// gzip bytes. Postgres will automatically convert `text`/`varchar` data into `bytea`
#[pg_extern]
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/composite_type/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using composite types.
use pgrx::{opname, pg_operator, prelude::*};

// All `pgrx` extensions will do this:
pgrx::pg_module_magic!(c"composite_type", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

/* Composite types must be defined either before they are used.

Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/custom_libname/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"custom_libname", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn hello_custom_libname() -> &'static str {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/custom_sql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use pgrx::prelude::*;
use serde::{Deserialize, Serialize};

pgrx::pg_module_magic!(c"custom_sql", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_schema]
mod home {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/custom_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod hstore_clone;
mod ordered;
mod rust_enum;

pgrx::pg_module_magic!(c"custom_types", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[cfg(test)]
pub mod pg_test {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/datetime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use pgrx::prelude::*;
use rand::Rng;

pgrx::pg_module_magic!(c"datetime", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern(name = "to_iso_string", immutable, parallel_safe)]
fn to_iso_string(tsz: TimestampWithTimeZone) -> String {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use pgrx::prelude::*;
use pgrx::{error, info, warning, PgRelation, FATAL, PANIC};

pgrx::pg_module_magic!(c"errors", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn array_with_null_and_panic(input: Vec<Option<i32>>) -> i64 {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/nostd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize};

use alloc::string::String;

pgrx::pg_module_magic!(c"nostd", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

/// standard Rust equality/comparison derives
#[derive(Eq, PartialEq, Ord, Hash, PartialOrd)]
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/numeric/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#![allow(clippy::assign_op_pattern)]
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"numeric", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn add_numeric(a: Numeric<1000, 33>, b: Numeric<1000, 33>) -> Numeric<1000, 33> {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/operators/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
mod derived;
mod pgvarlena;

pgrx::pg_module_magic!(c"operators", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[derive(PostgresType, Serialize, Deserialize, Eq, PartialEq)]
pub struct MyType {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/pgtrybuilder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use pgrx::pg_sys::panic::CaughtError;
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"pgtrybuilder", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn is_valid_number(i: i32) -> i32 {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/range/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"range", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn range(s: i32, e: i32) -> pgrx::Range<i32> {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/schemas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use pgrx::prelude::*;
use serde::{Deserialize, Serialize};

pgrx::pg_module_magic!(c"schemas", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[derive(PostgresType, Serialize, Deserialize)]
pub struct MyType(pub(crate) String);
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/shmem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use pgrx::{pg_shmem_init, warning};
use serde::*;
use std::sync::atomic::Ordering;

pgrx::pg_module_magic!(c"shmem", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

// types behind a `LwLock` must derive/implement `Copy` and `Clone`
#[derive(Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/spi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"spi", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

extension_sql!(
r#"
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/spi_srf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"spi_srf", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

extension_sql!(
r#"
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/srf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"srf", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn generate_series(start: i64, finish: i64, step: default!(i64, 1)) -> SetOfIterator<'static, i64> {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/strings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"strings", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn return_static() -> &'static str {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/triggers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"triggers", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[derive(thiserror::Error, Debug)]
enum TriggerError {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/versioned_custom_libname_so/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"versioned_custom_libname_so", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn hello_versioned_custom_libname_so() -> &'static str {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/versioned_so/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
use pgrx::prelude::*;

pgrx::pg_module_magic!(c"versioned_so", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

#[pg_extern]
fn hello_versioned_so() -> &'static str {
Expand Down
2 changes: 1 addition & 1 deletion pgrx-examples/wal_decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use serde::ser::{SerializeStruct, Serializer};
use serde::Serialize;
use std::alloc::{alloc, dealloc, Layout};

pgrx::pg_module_magic!(c"wal_decoder", pgrx::pg_sys::PG_VERSION);
pgrx::pg_module_magic!(name, version);

// An Action describe a change that occurred on a table
#[derive(Serialize)]
Expand Down
4 changes: 2 additions & 2 deletions pgrx-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ fn impl_postgres_type(ast: DeriveInput) -> syn::Result<proc_macro2::TokenStream>
#[::pgrx::pgrx_macros::pg_extern(immutable,parallel_safe)]
pub fn #funcname_in #generics(input: Option<&::core::ffi::CStr>) -> Option<#name #generics> {
input.map_or_else(|| {
for m in <#name as ::pgrx::inoutfuncs::InOutFuncs>::NULL_ERROR_MESSAGE {
if let Some(m) = <#name as ::pgrx::inoutfuncs::InOutFuncs>::NULL_ERROR_MESSAGE {
::pgrx::pg_sys::error!("{m}");
}
None
Expand All @@ -990,7 +990,7 @@ fn impl_postgres_type(ast: DeriveInput) -> syn::Result<proc_macro2::TokenStream>
#[::pgrx::pgrx_macros::pg_extern(immutable,parallel_safe)]
pub fn #funcname_in #generics(input: Option<&::core::ffi::CStr>) -> Option<::pgrx::datum::PgVarlena<#name #generics>> {
input.map_or_else(|| {
for m in <#name as ::pgrx::inoutfuncs::PgVarlenaInOutFuncs>::NULL_ERROR_MESSAGE {
if let Some(m) = <#name as ::pgrx::inoutfuncs::PgVarlenaInOutFuncs>::NULL_ERROR_MESSAGE {
::pgrx::pg_sys::error!("{m}");
}
None
Expand Down
6 changes: 6 additions & 0 deletions pgrx-pg-sys/src/include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#[cfg(all(feature = "pg13", not(docsrs)))]
pub(crate) mod pg13 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg13.rs"));
}
#[cfg(all(feature = "pg13", docsrs))]
Expand All @@ -13,6 +14,7 @@ pub(crate) mod pg13;
#[cfg(all(feature = "pg14", not(docsrs)))]
pub(crate) mod pg14 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg14.rs"));
}
#[cfg(all(feature = "pg14", docsrs))]
Expand All @@ -21,6 +23,7 @@ pub(crate) mod pg14;
#[cfg(all(feature = "pg15", not(docsrs)))]
pub(crate) mod pg15 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg15.rs"));
}
#[cfg(all(feature = "pg15", docsrs))]
Expand All @@ -29,6 +32,7 @@ pub(crate) mod pg15;
#[cfg(all(feature = "pg16", not(docsrs)))]
pub(crate) mod pg16 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg16.rs"));
}
#[cfg(all(feature = "pg16", docsrs))]
Expand All @@ -37,6 +41,7 @@ pub(crate) mod pg16;
#[cfg(all(feature = "pg17", not(docsrs)))]
pub(crate) mod pg17 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg17.rs"));
}
#[cfg(all(feature = "pg17", docsrs))]
Expand All @@ -45,6 +50,7 @@ pub(crate) mod pg17;
#[cfg(all(feature = "pg18", not(docsrs)))]
pub(crate) mod pg18 {
#![allow(clippy::all)]
#![allow(unknown_lints, unnecessary_transmutes)]
include!(concat!(env!("OUT_DIR"), "/pg18.rs"));
}
#[cfg(all(feature = "pg18", docsrs))]
Expand Down
2 changes: 1 addition & 1 deletion pgrx-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub use framework::*;
pub mod proptest;

#[cfg(any(test, feature = "pg_test"))]
pgrx::pg_module_magic!();
pgrx::pg_module_magic!(name, version);

#[cfg(test)]
pub mod pg_test {
Expand Down
2 changes: 2 additions & 0 deletions pgrx-tests/src/tests/hooks_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//LICENSE All rights reserved.
//LICENSE
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
#![allow(deprecated, static_mut_refs)]

#[cfg(any(test, feature = "pg_test"))]
#[pgrx::pg_schema]
mod tests {
Expand Down
4 changes: 3 additions & 1 deletion pgrx-tests/src/tests/trigger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ mod tests {
}

#[pg_trigger]
fn signature_aliased_both(_trigger: AliasedBorrowedPgTrigger) -> AliasedTriggerResult<'_> {
fn signature_aliased_both(
_trigger: AliasedBorrowedPgTrigger<'_>,
) -> AliasedTriggerResult<'_> {
unimplemented!("Only testing signature compiles")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use pgrx::prelude::*;
#[pg_extern]
fn returns_tuple_with_lifetime(
value: &'static str,
) -> TableIterator<(name!(a, &'static str), name!(b, Option<&'static str>))> {
) -> TableIterator<'static, (name!(a, &'static str), name!(b, Option<&'static str>))> {
TableIterator::once((value, Some(value)))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
warning: elided lifetime has a name
--> tests/compile-fail/table-iterators-arent-immortal.rs:6:19
|
6 | ) -> TableIterator<(name!(a, &'static str), name!(b, Option<&'static str>))> {
| ^ this elided lifetime gets resolved as `'static`
|
= note: `#[warn(elided_named_lifetimes)]` on by default
help: consider specifying it explicitly
|
6 | ) -> TableIterator<'static, (name!(a, &'static str), name!(b, Option<&'static str>))> {
| ++++++++

error[E0521]: borrowed data escapes outside of function
--> tests/compile-fail/table-iterators-arent-immortal.rs:6:78
--> tests/compile-fail/table-iterators-arent-immortal.rs:6:87
|
3 | #[pg_extern]
| ------------
| |
| lifetime `'fcx` defined here
| in this procedural macro expansion
...
6 | ) -> TableIterator<(name!(a, &'static str), name!(b, Option<&'static str>))> {
| ______________________________________________________________________________^
6 | ) -> TableIterator<'static, (name!(a, &'static str), name!(b, Option<&'static str>))> {
| _______________________________________________________________________________________^
7 | | TableIterator::once((value, Some(value)))
8 | | }
| | ^
Expand Down
Loading
Loading