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>
Properties
Section titled “Properties”BuiltIn
Section titled “BuiltIn”Gets the numeric built-in member only when this value has the BuiltIn tag.
public PgBuiltInOid? BuiltIn { get; }Value: PgBuiltInOid?
Invalid
Section titled “Invalid”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
Methods
Section titled “Methods”Custom(uint)
Section titled “Custom(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.
Equals(PgOid)
Section titled “Equals(PgOid)”public bool Equals(PgOid other)Parameters:
other — PgOid
Returns: bool
Equals(object)
Section titled “Equals(object)”public override bool Equals(object obj)Parameters:
obj — object
Returns: bool
FromBuiltIn(PgBuiltInOid)
Section titled “FromBuiltIn(PgBuiltInOid)”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.
FromBuiltIn(PgBuiltInOid, int)
Section titled “FromBuiltIn(PgBuiltInOid, int)”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.
FromValue(uint)
Section titled “FromValue(uint)”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.
FromValue(uint, int)
Section titled “FromValue(uint, int)”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.
GetHashCode()
Section titled “GetHashCode()”public override int GetHashCode()Returns: int
ToDatum(PgMemoryContext)
Section titled “ToDatum(PgMemoryContext)”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.
ToString()
Section titled “ToString()”Formats the exact numeric value as culture-independent unsigned decimal text.
public override string ToString()Returns: string
The decimal OID.
Operators
Section titled “Operators”operator ==(PgOid, PgOid)
Section titled “operator ==(PgOid, PgOid)”public static bool operator ==(PgOid left, PgOid right)Parameters:
left — PgOid
right — PgOid
Returns: bool
operator !=(PgOid, PgOid)
Section titled “operator !=(PgOid, PgOid)”public static bool operator !=(PgOid left, PgOid right)Parameters:
left — PgOid
right — PgOid
Returns: bool