macro_rules! FATAL {
($($arg:tt)*) => { ... };
}
Expand description
Log to Postgres’ fatal
log level. This will abort the current Postgres backend connection processs.
This macro accepts arguments like the println
and format
macros.
See fmt
for information about options.
Given some function:
use pgx::*;
#[pg_extern]
fn sum_array(input: Array<i32>) -> i64 {
let mut sum = 0 as i64;
for i in input {
pgx::FATAL!("i={index:?}, sum={}", sum, index = i);
sum += i.unwrap_or(-1) as i64;
}
sum
}
When run inside PostgreSQL would output:
arrays=# SELECT arrays.sum_array('{1,2,3}');
FATAL: i=Some(1), sum=0
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.