macro_rules! pg_binary_magic {
    ($($prelude:ident)::*) => { ... };
}
Expand description

Create the default SQL generator code.

Accepts a single argument, which should be the crate name.

// src/bin/sql-generator.rs
pg_binary_magic!(crate_name);

This creates a binary that:

  • Has tracing and color_eyre set up.
  • Supports EnvFilter log level configuration.
  • Accepts --sql path and --dot path args, as well as a list of symbols. These symbols are the __pgx_internals prefixed ones which cargo pgx schema detects.

Using different SQL generator code should be considered an advanced use case, and not recommended.

Note: cargo pgx schema or similar commands will automatically scaffold your src/bin/sql-generator.rs with this if it’s not already present.