Skip to content

ExtensionSchema

Namespace: Ankus.PgConfig

Assembly: Ankus.PgConfig.dll

Describes installation SQL embedded in a published Native AOT extension library.

public sealed class ExtensionSchema

Inheritance: object

Gets the original publication’s filenames, PostgreSQL major and measured native runtime identifier.

public PublishedExtension Artifacts { get; }

Value: PublishedExtension

Gets the effective fixed control schema, or null when installation selects the schema.

public string? DefaultSchema { get; }

Value: string

Gets the compiler dependency graph, or null for a legacy library containing only installation SQL.

public ExtensionSchemaGraph? Graph { get; }

Value: ExtensionSchemaGraph

Gets the extension’s PostgreSQL name.

public string Name { get; }

Value: string

Gets whether the extension’s declarations permit schema relocation.

public bool Relocatable { get; }

Value: bool

Gets the exact installation SQL, retaining MODULE_PATHNAME substitution for PostgreSQL installation. A versioned library’s SQL names that library directly instead.

public string Sql { get; }

Value: string

Gets the extension’s installation version.

public string Version { get; }

Value: string

Reads embedded installation metadata without loading or executing the native library or reading sidecar files.

public static ExtensionSchema Read(string libraryPath, string? runtimeIdentifier = null)

Parameters:

libraryPath — string

The published shared-library file.

runtimeIdentifier — string

An optional required RID; universal Mach-O files require osx-x64 or osx-arm64.

Returns: ExtensionSchema

The validated schema and publication identity.

Exceptions:

  • FormatException: The library, embedded format, target identity or bounded metadata is invalid.

Supports Linux x64 ELF, Windows x64 PE and macOS x64/ARM64 Mach-O libraries. Schema sections are limited to 64 MiB; native library contents are read through bounded file ranges.

Selects declarations by exact SQL name, managed name, signature or explicit dependency identifier.

public ExtensionSchemaSelection Select(IEnumerable<string> names, bool alterExtension = true)

Parameters:

names — IEnumerable<string>

One or more names; ambiguous names require a qualified name or signature.

alterExtension — bool

Whether to wrap creation and extension attachment in one transaction.

Returns: ExtensionSchemaSelection

The selected SQL, ordered dependency closure and attachment diagnostics.

Exceptions:

The extension must already exist when attaching objects. The concrete library must be installed in PostgreSQL’s library directory. Custom SQL without declared created objects remains in the script and produces a warning when attachment is requested.

Selects declarations for a known installation schema, resolving PostgreSQL’s reserved @extschema@ token.

public ExtensionSchemaSelection Select(IEnumerable<string> names, string extensionSchema, bool alterExtension = true)

Parameters:

names — IEnumerable<string>

One or more exact declaration names.

extensionSchema — string

The actual installation schema; it must agree with any fixed control schema.

alterExtension — bool

Whether to wrap creation and extension attachment in one transaction.

Returns: ExtensionSchemaSelection

Selected SQL with exact schema qualification and dependency closure.

Exceptions: