Skip to main content

TargetRewriteError

Enum TargetRewriteError 

Source
pub enum TargetRewriteError {
Show 13 variants Parse(String), NotReadOnly, WriteInReadPosition, UnsupportedTableSource(String), QualifiedTableName(String), PublicSubsetUndeclared(String), TenancyUndeclared(String), UnsupportedLiteral, BadColumn(String), EmptyConfinement(String), MissingTarget, UnsupportedJoin(String), CteNotAllowed,
}
Expand description

Why a raw-SQL target read is refused before it reaches the backend (always fail-closed — a target read that cannot be provably confined does not run).

Variants§

§

Parse(String)

The statement did not parse under the backend’s dialect.

§

NotReadOnly

Not a single read-only query: multiple statements, or a top-level statement that is not a SELECT / VALUES / set-operation (a write or DDL). Target reads are read-only.

§

WriteInReadPosition

A write was smuggled into a read position (a SELECT … INTO, a TABLE t shorthand, or an INSERT/UPDATE inside a CTE / set-op arm).

§

UnsupportedTableSource(String)

A table source the confinement cannot reason about (a table-valued function, UNNEST, PIVOT/UNPIVOT, JSON_TABLE, MATCH_RECOGNIZE, …) — refused rather than left unconfined.

§

QualifiedTableName(String)

A schema-/database-qualified table name (schema.table). A target read must use bare table identifiers so the per-table key/public lookup is unambiguous (a qualified name could point at a different physical table than the schema entry it would be confined by).

§

PublicSubsetUndeclared(String)

A table accessed under a target read declares no PUBLIC subset (deny-by-default — the strict analog of the ORM’s PublicSubsetUndeclared).

§

TenancyUndeclared(String)

A table accessed under a target read has no declared tenant key in the schema (deny-by-default — the analog of TenancyUndeclared).

§

UnsupportedLiteral

The tenant B value, or a public-subset literal, cannot be rendered as a safe SQL literal (a blob / JSON / null / non-finite float where a scalar was required).

§

BadColumn(String)

A tenant/public column in the schema is not a valid SQL identifier (operator misconfig).

§

EmptyConfinement(String)

A declared subset lowered to no confinement at all (empty predicate on an unscoped table) — would match every row; refused. (The schema validator rejects empty predicates up front; this is the injector-level backstop.)

§

MissingTarget

A target read was attempted with no resolved target tenant B (the principal carried no TargetTenant fact). Unreachable by construction — a target principal always resolves B — but refused fail-closed rather than run unconfined.

§

UnsupportedJoin(String)

A join the target-read confinement cannot soundly place: a RIGHT/FULL OUTER join (the driving side is nullable), a semi/anti/apply/asof join, or a LEFT OUTER join with a USING/NATURAL/ no constraint (no ON to inject the confinement into). Refused fail-closed — the ORM target path is INNER + LEFT-ON only, and the same read is expressible as a LEFT … ON join.

§

CteNotAllowed

The statement used a WITH (CTE). CTEs are refused in a raw-SQL target read (deny-by-default, matching the ORM target path, which does not support CTEs): a non-recursive CTE’s body may reference the base table under the CTE’s own name, and a recursive CTE references itself, so a name-based “is this a CTE reference?” test cannot soundly distinguish a base-table read from a CTE reference — the safe collapse is to refuse. The same read is expressible with a derived table / subquery, which IS confined.

Implementations§

Source§

impl TargetRewriteError

Source

pub fn reason(&self) -> String

A short, guest-safe reason (no tenant values leaked).

Trait Implementations§

Source§

impl Clone for TargetRewriteError

Source§

fn clone(&self) -> TargetRewriteError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TargetRewriteError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TargetRewriteError

Source§

impl PartialEq for TargetRewriteError

Source§

fn eq(&self, other: &TargetRewriteError) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TargetRewriteError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more