Skip to content

PublishedExtension

Namespace: Ankus.PgConfig

Assembly: Ankus.PgConfig.dll

Describes the native library, SQL scripts and control files produced by one extension publish.

public sealed class PublishedExtension

Inheritance: object

PublishedExtension(int, string, string, string, string)

Section titled “PublishedExtension(int, string, string, string, string)”

Creates a manifest with filename-only artifact names.

public PublishedExtension(int postgresMajor, string runtimeIdentifier, string library, string control, string sql)

Parameters:

postgresMajor — int

The PostgreSQL header major used to compile the extension.

runtimeIdentifier — string

The Native AOT runtime identifier.

library — string

The native library filename.

control — string

The control filename under extension/.

sql — string

The versioned SQL filename under extension/.

PublishedExtension(int, string, string, string, string, IReadOnlyList<string>)

Section titled “PublishedExtension(int, string, string, string, string, IReadOnlyList<string>)”

Creates a manifest with an owned, ordered collection of extension upgrade scripts.

public PublishedExtension(int postgresMajor, string runtimeIdentifier, string library, string control, string sql, IReadOnlyList<string> upgradeScripts)

Parameters:

postgresMajor — int

The PostgreSQL header major used to compile the extension.

runtimeIdentifier — string

The Native AOT runtime identifier.

library — string

The native library filename.

control — string

The control filename under extension/.

sql — string

The installation SQL filename under extension/.

upgradeScripts — IReadOnlyList<string>

Upgrade filenames in extension–old–new.sql form.

PublishedExtension(int, string, string, string, string, IReadOnlyList<string>, IReadOnlyList<string>)

Section titled “PublishedExtension(int, string, string, string, string, IReadOnlyList<string>, IReadOnlyList<string>)”

Creates a manifest with owned, ordered upgrade scripts and version-specific control files.

public PublishedExtension(int postgresMajor, string runtimeIdentifier, string library, string control, string sql, IReadOnlyList<string> upgradeScripts, IReadOnlyList<string> versionControlFiles)

Parameters:

postgresMajor — int

The PostgreSQL header major used to compile the extension.

runtimeIdentifier — string

The Native AOT runtime identifier.

library — string

The native library filename.

control — string

The primary control filename under extension/.

sql — string

The installation SQL filename under extension/.

upgradeScripts — IReadOnlyList<string>

Upgrade filenames in extension–old–new.sql form.

versionControlFiles — IReadOnlyList<string>

Secondary control filenames in extension–version.control form.

PublishedExtension(int, string, string, string, string, IReadOnlyList<string>, IReadOnlyList<string>, string?)

Section titled “PublishedExtension(int, string, string, string, string, IReadOnlyList<string>, IReadOnlyList<string>, string?)”

Creates a manifest with a declared PostgreSQL SQL directory and a flat, owned publication payload.

public PublishedExtension(int postgresMajor, string runtimeIdentifier, string library, string control, string sql, IReadOnlyList<string> upgradeScripts, IReadOnlyList<string> versionControlFiles, string? scriptDirectory)

Parameters:

postgresMajor — int

The PostgreSQL header major used to compile the extension.

runtimeIdentifier — string

The Native AOT runtime identifier.

library — string

The native library filename.

control — string

The primary control filename under extension/.

sql — string

The installation SQL filename under extension/.

upgradeScripts — IReadOnlyList<string>

Upgrade filenames in extension–old–new.sql form.

versionControlFiles — IReadOnlyList<string>

Secondary control filenames in extension–version.control form.

scriptDirectory — string

The literal primary control directory setting, or null for PostgreSQL’s default.

PublishedExtension(int, string, string, string, string, IReadOnlyList<string>, IReadOnlyList<string>, string?, IReadOnlyList<string>)

Section titled “PublishedExtension(int, string, string, string, string, IReadOnlyList<string>, IReadOnlyList<string>, string?, IReadOnlyList<string>)”

Creates a manifest whose publication also contains modules that load the extension’s output plugin under other names.

public PublishedExtension(int postgresMajor, string runtimeIdentifier, string library, string control, string sql, IReadOnlyList<string> upgradeScripts, IReadOnlyList<string> versionControlFiles, string? scriptDirectory, IReadOnlyList<string> pluginLibraries)

Parameters:

postgresMajor — int

The PostgreSQL header major used to compile the extension.

runtimeIdentifier — string

The Native AOT runtime identifier.

library — string

The native library filename.

control — string

The primary control filename under extension/.

sql — string

The installation SQL filename under extension/.

upgradeScripts — IReadOnlyList<string>

Upgrade filenames in extension–old–new.sql form.

versionControlFiles — IReadOnlyList<string>

Secondary control filenames in extension–version.control form.

scriptDirectory — string

The literal primary control directory setting, or null for PostgreSQL’s default.

pluginLibraries — IReadOnlyList<string>

Output plugin alias module filenames, installed beside the library.

Validates the complete payload, removes obsolete owned SQL, control and output plugin files, and makes the publication installable.

public void CompletePublish(string directory)

Parameters:

directory — string

The directory containing the native library and extension files.

Verifies the published control’s directory and returns its fully qualified PostgreSQL SQL path.

public string GetScriptDirectory(string publishDirectory, string baseDirectory)

Parameters:

publishDirectory — string

The publication containing the primary control under extension/.

baseDirectory — string

The PostgreSQL shared directory, or a PostgreSQL 18+ extension search base.

Returns: string

The directory for SQL scripts and secondary controls, preserving Unix traversal components.

Exceptions:

  • FormatException: The control disagrees with the manifest or uses an ambiguous rooted path.

PostgreSQL traverses Unix paths through the filesystem. Removing a directory before a parent component can change its meaning, including when that directory is a symbolic link.

Invalidates a previous publication while retaining its file inventory for the next successful publish.

public static void Invalidate(string directory)

Parameters:

directory — string

The publish directory.

Reads a published manifest without reflection-based deserialization.

public static PublishedExtension Read(string directory)

Parameters:

directory — string

The publish directory.

Returns: PublishedExtension

The validated manifest.

Writes the manifest to an existing artifact directory.

public void Write(string directory)

Parameters:

directory — string

The artifact directory.

Gets the control filename within the extension directory.

public string Control { get; }

Value: string

Gets the native library filename.

public string Library { get; }

Value: string

Gets the filenames of modules that load the extension’s output plugin under other names, installed beside the library.

public IReadOnlyList<string> PluginLibraries { get; }

Value: IReadOnlyList<string>

Gets the PostgreSQL major whose headers were used to compile this library.

public int PostgresMajor { get; }

Value: int

Gets the runtime identifier used by Native AOT.

public string RuntimeIdentifier { get; }

Value: string

Gets the literal SQL directory setting, or null when PostgreSQL uses its control file directory.

public string? ScriptDirectory { get; }

Value: string

Gets the versioned SQL filename within the extension directory.

public string Sql { get; }

Value: string

Gets the ordered upgrade filenames within the extension directory.

public IReadOnlyList<string> UpgradeScripts { get; }

Value: IReadOnlyList<string>

Gets the ordered version-specific control filenames within the extension directory.

public IReadOnlyList<string> VersionControlFiles { get; }

Value: IReadOnlyList<string>

Gets the manifest filename placed alongside a published native library.

public const string FileName = "ankus.extension.json"