PgFunctionAttribute
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Exposes a static .NET method as a PostgreSQL function through generated native entry points and SQL.
[AttributeUsage(AttributeTargets.Method)]public sealed class PgFunctionAttribute : AttributeInheritance: object, Attribute
Constructors
Section titled “Constructors”PgFunctionAttribute()
Section titled “PgFunctionAttribute()”public PgFunctionAttribute()Properties
Section titled “Properties”Gets or sets the positive finite planner cost in cpu_operator_cost units. The C-language default is one.
public double Cost { get; set; }Value: double
CreateOrReplace
Section titled “CreateOrReplace”Gets or sets whether installation uses CREATE OR REPLACE FUNCTION.
public bool CreateOrReplace { get; set; }Value: bool
GenerateSql
Section titled “GenerateSql”Gets or sets whether installation SQL is emitted for this function and its attached operators or casts. The default is true. False retains the managed method, native entry points and dependency identifiers. Cannot be false when Sql contains a replacement, including an empty string.
public bool GenerateSql { get; set; }Value: bool
Gets or sets a unique, case-sensitive identifier used by installation SQL dependencies. It does not change the function’s SQL name or signature.
public string? Id { get; set; }Value: string
Leakproof
Section titled “Leakproof”Gets or sets the claim that the function reveals no argument information except through its result. PostgreSQL requires superuser privileges to install a leakproof function.
public bool Leakproof { get; set; }Value: bool
Gets or sets the SQL function name. The default is the method name converted to snake_case.
public string? Name { get; set; }Value: string
NullInput
Section titled “NullInput”Gets or sets SQL NULL dispatch behavior. The default infers strictness from SQL parameter nullability.
public PgNullInput NullInput { get; set; }Value: PgNullInput
ParallelSafety
Section titled “ParallelSafety”Gets or sets whether PostgreSQL may execute this function in parallel queries. The default is Unsafe.
public PgParallelSafety ParallelSafety { get; set; }Value: PgParallelSafety
Requires
Section titled “Requires”Gets or sets identifiers of SQL blocks or generated declarations that must precede this function.
public string[] Requires { get; set; }Value: string[]
Gets or sets the positive finite estimated row count for a set-returning function. The default is 1000. This option is only valid for IEnumerable returns.
public double Rows { get; set; }Value: double
Schema
Section titled “Schema”Gets or sets an existing SQL schema, overriding the nearest PgSchema declaration. Declare PgSchema separately when the extension should create the schema. A fixed schema makes the extension non-relocatable.
public string? Schema { get; set; }Value: string
SearchPath
Section titled “SearchPath”Gets or sets an ordered schema search path scoped to this function. Null preserves the caller’s search path. Each entry is a schema identifier, including the special $user and pg_temp entries. Use ExtensionSchema for the schema selected during CREATE EXTENSION. Such a generated search path makes the extension non-relocatable.
public string[]? SearchPath { get; set; }Value: string[]
SecurityDefiner
Section titled “SecurityDefiner”Gets or sets whether the function executes with its owner’s privileges instead of the caller’s.
public bool SecurityDefiner { get; set; }Value: bool
SetMode
Section titled “SetMode”Gets or sets how a set-returning function produces rows. Auto prefers one row per call. This option is only valid for IEnumerable returns.
public PgSetMode SetMode { get; set; }Value: PgSetMode
Gets or sets literal installation SQL replacing this function and its attached operators or casts. Null preserves generated SQL; empty text emits no statements. Native entry points remain generated. Replaces @FUNCTION_NAME@ with the native export and @MODULE_PATHNAME@ with MODULE_PATHNAME without adding quotes.
public string? Sql { get; set; }Value: string
Replacement declarations must match the managed wrapper’s argument, result and NULL contracts. Explicit dependencies and type/schema prerequisites still apply. For an aggregate helper this affects only that helper, not the aggregate declaration. SQL syntax and object definitions are checked by PostgreSQL.
SqlRelocatable
Section titled “SqlRelocatable”Gets or sets whether the literal Sql replacement permits moving the extension to another schema. The default is false. This option is consulted only when Sql is non-null; fixed schemas and other non-relocatable declarations can still prevent relocation.
public bool SqlRelocatable { get; set; }Value: bool
SupportFunction
Section titled “SupportFunction”Gets or sets the name of an existing planner support function, optionally qualified with one schema. PostgreSQL resolves and validates its internal-to-internal signature during installation.
public string? SupportFunction { get; set; }Value: string
Volatility
Section titled “Volatility”Gets or sets the planner’s volatility contract. The default is Volatile.
public PgVolatility Volatility { get; set; }Value: PgVolatility