Skip to content

PgOid

Namespace: Ankus

Assembly: Ankus.Runtime.dll

Classifies an exact unsigned OID as invalid, custom, or a recognized built-in constant.

public readonly struct PgOid : IEquatable<PgOid>

This corresponds to pgrx’s tagged PgOid helper. PostgreSQL oid datums use uint in Ankus. Classification does not validate existence or object category. Equality retains both the tag and numeric value; an explicitly custom value remains distinct from an invalid or built-in value with the same number.

Implements: IEquatable<PgOid>

Gets the numeric built-in member only when this value has the BuiltIn tag.

public PgBuiltInOid? BuiltIn { get; }

Value: PgBuiltInOid?

Gets the invalid variant with value zero; this is also the default value.

public static PgOid Invalid { get; }

Value: PgOid

Gets the retained classification tag.

public PgOidKind Kind { get; }

Value: PgOidKind

Gets the exact unsigned numeric value, independently of its classification.

public uint Value { get; }

Value: uint

Retains an explicitly custom value without reclassification, including zero or a known built-in number.

public static PgOid Custom(uint value)

Parameters:

value — uint

The exact custom value.

Returns: PgOid

The custom variant.

public bool Equals(PgOid other)

Parameters:

other — PgOid

Returns: bool

public override bool Equals(object obj)

Parameters:

obj — object

Returns: bool

Creates a built-in variant after checking active-version membership.

public static PgOid FromBuiltIn(PgBuiltInOid value)

Parameters:

value — PgBuiltInOid

The built-in candidate.

Returns: PgOid

The built-in variant.

Creates a built-in variant after checking explicit-version membership.

public static PgOid FromBuiltIn(PgBuiltInOid value, int postgresMajor)

Parameters:

value — PgBuiltInOid

The built-in candidate; undefined and unavailable members are rejected.

postgresMajor — int

The PostgreSQL major version, from 13 through 19.

Returns: PgOid

The built-in variant.

Classifies an unsigned OID using the active backend’s major version.

public static PgOid FromValue(uint value)

Parameters:

value — uint

The exact OID.

Returns: PgOid

The invalid, built-in, or custom variant.

Classifies an unsigned OID using an explicit major version without requiring a backend.

public static PgOid FromValue(uint value, int postgresMajor)

Parameters:

value — uint

The exact OID.

postgresMajor — int

The PostgreSQL major version, from 13 through 19.

Returns: PgOid

The invalid, built-in, or custom variant.

public override int GetHashCode()

Returns: int

Creates an oid datum, mapping only the Invalid tag to SQL NULL.

public PgDatum ToDatum(PgMemoryContext context)

Parameters:

context — PgMemoryContext

The explicit lifetime anchor for the by-value datum.

Returns: PgDatum

A checked oid datum; Custom(0) remains a present zero.

This preserves pgrx’s PgOid IntoDatum distinction between Invalid and Custom(0). Raw uint parameters and results independently preserve every unsigned value, including zero.

Formats the exact numeric value as culture-independent unsigned decimal text.

public override string ToString()

Returns: string

The decimal OID.

public static bool operator ==(PgOid left, PgOid right)

Parameters:

left — PgOid

right — PgOid

Returns: bool

public static bool operator !=(PgOid left, PgOid right)

Parameters:

left — PgOid

right — PgOid

Returns: bool