ExtensionSchema
Namespace: Ankus.PgConfig
Assembly: Ankus.PgConfig.dll
Describes installation SQL embedded in a published Native AOT extension library.
public sealed class ExtensionSchemaInheritance: object
Properties
Section titled “Properties”Artifacts
Section titled “Artifacts”Gets the original publication’s filenames, PostgreSQL major and measured native runtime identifier.
public PublishedExtension Artifacts { get; }Value: PublishedExtension
DefaultSchema
Section titled “DefaultSchema”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
Relocatable
Section titled “Relocatable”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
Version
Section titled “Version”Gets the extension’s installation version.
public string Version { get; }Value: string
Methods
Section titled “Methods”Read(string, string?)
Section titled “Read(string, 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.
Select(IEnumerable<string>, bool)
Section titled “Select(IEnumerable<string>, bool)”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:
- InvalidOperationException: The library predates embedded dependency graphs, or selected SQL needs an installation schema absent from metadata.
- ArgumentException: A selection is empty, unknown or ambiguous.
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.
Select(IEnumerable<string>, string, bool)
Section titled “Select(IEnumerable<string>, string, bool)”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:
- ArgumentNullException: Names or the installation schema is null.
- ArgumentException: The selection or schema is invalid, or the schema conflicts with fixed metadata.
- InvalidOperationException: The library predates embedded dependency graphs.