<h3 dir="auto">Discussed in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="4992065" data-permission-text="Title is private" data-url="https://github.com/sqlalchemy/sqlalchemy/discussions/9525" data-hovercard-type="discussion" data-hovercard-url="/sqlalchemy/sqlalchemy/discussions/9525/hovercard" href="https://github.com/sqlalchemy/sqlalchemy/discussions/9525">#9525</a></h3>
<p dir="auto">still figuring out what this is.  Oracle has to use literal render, so this is not really an oracle thing, it's something w literal render</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import func
from sqlalchemy import Identity
from sqlalchemy import Integer
from sqlalchemy import select
from sqlalchemy import String
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import foreign
from sqlalchemy.orm import relationship
from sqlalchemy.orm import Session

Base = declarative_base()


class Model(Base):
    __tablename__ = &quot;model&quot;
    id = Column(Integer, Identity(), primary_key=True)
    name = Column(String(50))


class Item(Base):
    __tablename__ = &quot;item&quot;

    id = Column(Integer, Identity(), primary_key=True)
    model_name = Column(String(50))

    actual_model = relationship(
        &quot;Model&quot;,
        viewonly=True,
        primaryjoin=(
            &quot;Model.name == func.coalesce(&quot;
            &quot;  foreign(Item.model_name), &quot;
            '  select(Config.default_model_name).filter(Config.name == &quot;default&quot;).limit(1).scalar_subquery()'
            &quot;)&quot;
        ),
    )


class Config(Base):
    __tablename__ = &quot;config&quot;

    id = Column(Integer, Identity(), primary_key=True)
    name = Column(String(50))
    default_model_name = Column(String(50))


# e = create_engine(&quot;sqlite://&quot;, echo=True)
e = create_engine(&quot;oracle://scott:tiger@oracle18c&quot;, echo=True)
Base.metadata.drop_all(e)
Base.metadata.create_all(e)

with Session(e) as sess:
    sess.add_all(
        [
            Config(name=&quot;default&quot;, default_model_name=&quot;model1&quot;),
            Item(model_name=&quot;model1&quot;),
            Model(name=&quot;model1&quot;),
        ]
    )
    sess.commit()

with Session(e) as sess:

    # works fine
    stmt = select(
        func.coalesce(
            foreign(Item.model_name),
            select(Config.default_model_name)
            .filter(Config.name == &quot;default&quot;)
            .limit(1)
            .scalar_subquery(),
        )
    )
    from sqlalchemy.sql.util import _deep_annotate
    stmt = _deep_annotate(stmt, {&quot;foo&quot;: &quot;bar&quot;})
    sess.execute(stmt)


    # ORM version fails
    i1 = sess.scalars(select(Item)).one()
    print(i1.actual_model)
"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span> <span class="pl-k">import</span> <span class="pl-v">Column</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span> <span class="pl-k">import</span> <span class="pl-s1">create_engine</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span> <span class="pl-k">import</span> <span class="pl-s1">func</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span> <span class="pl-k">import</span> <span class="pl-v">Identity</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span> <span class="pl-k">import</span> <span class="pl-v">Integer</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span> <span class="pl-k">import</span> <span class="pl-s1">select</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span> <span class="pl-k">import</span> <span class="pl-v">String</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span>.<span class="pl-s1">orm</span> <span class="pl-k">import</span> <span class="pl-s1">declarative_base</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span>.<span class="pl-s1">orm</span> <span class="pl-k">import</span> <span class="pl-s1">foreign</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span>.<span class="pl-s1">orm</span> <span class="pl-k">import</span> <span class="pl-s1">relationship</span>
<span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span>.<span class="pl-s1">orm</span> <span class="pl-k">import</span> <span class="pl-v">Session</span>

<span class="pl-v">Base</span> <span class="pl-c1">=</span> <span class="pl-en">declarative_base</span>()


<span class="pl-k">class</span> <span class="pl-v">Model</span>(<span class="pl-v">Base</span>):
    <span class="pl-s1">__tablename__</span> <span class="pl-c1">=</span> <span class="pl-s">"model"</span>
    <span class="pl-s1">id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">Integer</span>, <span class="pl-v">Identity</span>(), <span class="pl-s1">primary_key</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
    <span class="pl-s1">name</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">String</span>(<span class="pl-c1">50</span>))


<span class="pl-k">class</span> <span class="pl-v">Item</span>(<span class="pl-v">Base</span>):
    <span class="pl-s1">__tablename__</span> <span class="pl-c1">=</span> <span class="pl-s">"item"</span>

    <span class="pl-s1">id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">Integer</span>, <span class="pl-v">Identity</span>(), <span class="pl-s1">primary_key</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
    <span class="pl-s1">model_name</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">String</span>(<span class="pl-c1">50</span>))

    <span class="pl-s1">actual_model</span> <span class="pl-c1">=</span> <span class="pl-en">relationship</span>(
        <span class="pl-s">"Model"</span>,
        <span class="pl-s1">viewonly</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
        <span class="pl-s1">primaryjoin</span><span class="pl-c1">=</span>(
            <span class="pl-s">"Model.name == func.coalesce("</span>
            <span class="pl-s">"  foreign(Item.model_name), "</span>
            <span class="pl-s">'  select(Config.default_model_name).filter(Config.name == "default").limit(1).scalar_subquery()'</span>
            <span class="pl-s">")"</span>
        ),
    )


<span class="pl-k">class</span> <span class="pl-v">Config</span>(<span class="pl-v">Base</span>):
    <span class="pl-s1">__tablename__</span> <span class="pl-c1">=</span> <span class="pl-s">"config"</span>

    <span class="pl-s1">id</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">Integer</span>, <span class="pl-v">Identity</span>(), <span class="pl-s1">primary_key</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
    <span class="pl-s1">name</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">String</span>(<span class="pl-c1">50</span>))
    <span class="pl-s1">default_model_name</span> <span class="pl-c1">=</span> <span class="pl-v">Column</span>(<span class="pl-v">String</span>(<span class="pl-c1">50</span>))


<span class="pl-c"># e = create_engine("sqlite://", echo=True)</span>
<span class="pl-s1">e</span> <span class="pl-c1">=</span> <span class="pl-en">create_engine</span>(<span class="pl-s">"oracle://scott:tiger@oracle18c"</span>, <span class="pl-s1">echo</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-v">Base</span>.<span class="pl-s1">metadata</span>.<span class="pl-en">drop_all</span>(<span class="pl-s1">e</span>)
<span class="pl-v">Base</span>.<span class="pl-s1">metadata</span>.<span class="pl-en">create_all</span>(<span class="pl-s1">e</span>)

<span class="pl-k">with</span> <span class="pl-v">Session</span>(<span class="pl-s1">e</span>) <span class="pl-k">as</span> <span class="pl-s1">sess</span>:
    <span class="pl-s1">sess</span>.<span class="pl-en">add_all</span>(
        [
            <span class="pl-v">Config</span>(<span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">"default"</span>, <span class="pl-s1">default_model_name</span><span class="pl-c1">=</span><span class="pl-s">"model1"</span>),
            <span class="pl-v">Item</span>(<span class="pl-s1">model_name</span><span class="pl-c1">=</span><span class="pl-s">"model1"</span>),
            <span class="pl-v">Model</span>(<span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">"model1"</span>),
        ]
    )
    <span class="pl-s1">sess</span>.<span class="pl-en">commit</span>()

<span class="pl-k">with</span> <span class="pl-v">Session</span>(<span class="pl-s1">e</span>) <span class="pl-k">as</span> <span class="pl-s1">sess</span>:

    <span class="pl-c"># works fine</span>
    <span class="pl-s1">stmt</span> <span class="pl-c1">=</span> <span class="pl-en">select</span>(
        <span class="pl-s1">func</span>.<span class="pl-en">coalesce</span>(
            <span class="pl-en">foreign</span>(<span class="pl-v">Item</span>.<span class="pl-s1">model_name</span>),
            <span class="pl-en">select</span>(<span class="pl-v">Config</span>.<span class="pl-s1">default_model_name</span>)
            .<span class="pl-en">filter</span>(<span class="pl-v">Config</span>.<span class="pl-s1">name</span> <span class="pl-c1">==</span> <span class="pl-s">"default"</span>)
            .<span class="pl-en">limit</span>(<span class="pl-c1">1</span>)
            .<span class="pl-en">scalar_subquery</span>(),
        )
    )
    <span class="pl-k">from</span> <span class="pl-s1">sqlalchemy</span>.<span class="pl-s1">sql</span>.<span class="pl-s1">util</span> <span class="pl-k">import</span> <span class="pl-s1">_deep_annotate</span>
    <span class="pl-s1">stmt</span> <span class="pl-c1">=</span> <span class="pl-en">_deep_annotate</span>(<span class="pl-s1">stmt</span>, {<span class="pl-s">"foo"</span>: <span class="pl-s">"bar"</span>})
    <span class="pl-s1">sess</span>.<span class="pl-en">execute</span>(<span class="pl-s1">stmt</span>)


    <span class="pl-c"># ORM version fails</span>
    <span class="pl-s1">i1</span> <span class="pl-c1">=</span> <span class="pl-s1">sess</span>.<span class="pl-en">scalars</span>(<span class="pl-en">select</span>(<span class="pl-v">Item</span>)).<span class="pl-en">one</span>()
    <span class="pl-en">print</span>(<span class="pl-s1">i1</span>.<span class="pl-s1">actual_model</span>)</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;/home/classic/dev/sqlalchemy/test3.py&quot;, line 82, in &lt;module&gt;
    print(i1.actual_model)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py&quot;, line 557, in __get__
    return self.impl.get(state, dict_)  # type: ignore[no-any-return]
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py&quot;, line 1070, in get
    value = self._fire_loader_callables(state, key, passive)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py&quot;, line 1105, in _fire_loader_callables
    return self.callable_(state, passive)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/strategies.py&quot;, line 972, in _load_for_state
    return self._emit_lazyload(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/strategies.py&quot;, line 1135, in _emit_lazyload
    result = session.execute(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/session.py&quot;, line 2229, in execute
    return self._execute_internal(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/session.py&quot;, line 2124, in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/context.py&quot;, line 253, in orm_execute_statement
    result = conn.execute(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py&quot;, line 1414, in execute
    return meth(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/elements.py&quot;, line 486, in _execute_on_connection
    return connection._execute_clauseelement(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py&quot;, line 1630, in _execute_clauseelement
    compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/elements.py&quot;, line 652, in _compile_w_cache
    compiled_sql = self._compiler(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/elements.py&quot;, line 291, in _compiler
    return dialect.statement_compiler(dialect, self, **kw)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/oracle/base.py&quot;, line 820, in __init__
    super().__init__(*args, **kwargs)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 1269, in __init__
    Compiled.__init__(self, dialect, statement, **kwargs)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 710, in __init__
    self.string = self.process(self.statement, **compile_kwargs)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 755, in process
    return obj._compiler_dispatch(self, **kwargs)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py&quot;, line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 4551, in visit_select
    text = self._compose_select_body(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 4713, in _compose_select_body
    t = self._generate_delimited_and_list(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 2528, in _generate_delimited_and_list
    return clauses[0]._compiler_dispatch(self, **kw)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py&quot;, line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py&quot;, line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 3143, in visit_binary
    return self._generate_generic_binary(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 3199, in _generate_generic_binary
    + binary.right._compiler_dispatch(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py&quot;, line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py&quot;, line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/oracle/base.py&quot;, line 859, in visit_function
    text = super().visit_function(func, **kw)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 2711, in visit_function
    ) % {&quot;expr&quot;: self.function_argspec(func, **kwargs)}
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/oracle/base.py&quot;, line 854, in function_argspec
    return compiler.SQLCompiler.function_argspec(self, fn, **kw)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 2727, in function_argspec
    return func.clause_expr._compiler_dispatch(self, **kwargs)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py&quot;, line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py&quot;, line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 2179, in visit_grouping
    return &quot;(&quot; + grouping.element._compiler_dispatch(self, **kwargs) + &quot;)&quot;
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py&quot;, line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py&quot;, line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 2547, in visit_clauselist
    return self._generate_delimited_list(clauselist.clauses, sep, **kw)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 2513, in _generate_delimited_list
    return separator.join(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 2513, in &lt;genexpr&gt;
    return separator.join(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 2515, in &lt;genexpr&gt;
    for s in (c._compiler_dispatch(self, **kw) for c in elements)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py&quot;, line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py&quot;, line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 2179, in visit_grouping
    return &quot;(&quot; + grouping.element._compiler_dispatch(self, **kwargs) + &quot;)&quot;
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py&quot;, line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 4551, in visit_select
    text = self._compose_select_body(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 4737, in _compose_select_body
    text += self._row_limit_clause(select, **kwargs)
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/oracle/base.py&quot;, line 1031, in _row_limit_clause
    return self.fetch_clause(
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py&quot;, line 4931, in fetch_clause
    fetch_clause = fetch_clause.render_literal_execute()
  File &quot;/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/elements.py&quot;, line 2060, in render_literal_execute
    return self.__class__(
TypeError: Annotated.__new__() got an unexpected keyword argument 'type_'
"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "/home/classic/dev/sqlalchemy/test3.py", line 82, in &lt;module&gt;
    print(i1.actual_model)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py", line 557, in __get__
    return self.impl.get(state, dict_)  # type: ignore[no-any-return]
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py", line 1070, in get
    value = self._fire_loader_callables(state, key, passive)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py", line 1105, in _fire_loader_callables
    return self.callable_(state, passive)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/strategies.py", line 972, in _load_for_state
    return self._emit_lazyload(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/strategies.py", line 1135, in _emit_lazyload
    result = session.execute(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/session.py", line 2229, in execute
    return self._execute_internal(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/session.py", line 2124, in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/orm/context.py", line 253, in orm_execute_statement
    result = conn.execute(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py", line 1414, in execute
    return meth(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/elements.py", line 486, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py", line 1630, in _execute_clauseelement
    compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/elements.py", line 652, in _compile_w_cache
    compiled_sql = self._compiler(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/elements.py", line 291, in _compiler
    return dialect.statement_compiler(dialect, self, **kw)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/oracle/base.py", line 820, in __init__
    super().__init__(*args, **kwargs)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 1269, in __init__
    Compiled.__init__(self, dialect, statement, **kwargs)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 710, in __init__
    self.string = self.process(self.statement, **compile_kwargs)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 755, in process
    return obj._compiler_dispatch(self, **kwargs)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py", line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 4551, in visit_select
    text = self._compose_select_body(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 4713, in _compose_select_body
    t = self._generate_delimited_and_list(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 2528, in _generate_delimited_and_list
    return clauses[0]._compiler_dispatch(self, **kw)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py", line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py", line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 3143, in visit_binary
    return self._generate_generic_binary(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 3199, in _generate_generic_binary
    + binary.right._compiler_dispatch(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py", line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py", line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/oracle/base.py", line 859, in visit_function
    text = super().visit_function(func, **kw)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 2711, in visit_function
    ) % {"expr": self.function_argspec(func, **kwargs)}
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/oracle/base.py", line 854, in function_argspec
    return compiler.SQLCompiler.function_argspec(self, fn, **kw)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 2727, in function_argspec
    return func.clause_expr._compiler_dispatch(self, **kwargs)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py", line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py", line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 2179, in visit_grouping
    return "(" + grouping.element._compiler_dispatch(self, **kwargs) + ")"
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py", line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py", line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 2547, in visit_clauselist
    return self._generate_delimited_list(clauselist.clauses, sep, **kw)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 2513, in _generate_delimited_list
    return separator.join(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 2513, in &lt;genexpr&gt;
    return separator.join(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 2515, in &lt;genexpr&gt;
    for s in (c._compiler_dispatch(self, **kw) for c in elements)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/annotation.py", line 351, in _compiler_dispatch
    return self.__element.__class__._compiler_dispatch(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py", line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 2179, in visit_grouping
    return "(" + grouping.element._compiler_dispatch(self, **kwargs) + ")"
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/visitors.py", line 143, in _compiler_dispatch
    return meth(self, **kw)  # type: ignore  # noqa: E501
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 4551, in visit_select
    text = self._compose_select_body(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 4737, in _compose_select_body
    text += self._row_limit_clause(select, **kwargs)
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/oracle/base.py", line 1031, in _row_limit_clause
    return self.fetch_clause(
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/compiler.py", line 4931, in fetch_clause
    fetch_clause = fetch_clause.render_literal_execute()
  File "/home/classic/dev/sqlalchemy/lib/sqlalchemy/sql/elements.py", line 2060, in render_literal_execute
    return self.__class__(
TypeError: Annotated.__new__() got an unexpected keyword argument 'type_'

</code></pre></div>
<p dir="auto"><strong>Migrated issue, originally created by Anonymous</strong></p>
<p dir="auto">Is this not something that could be enabled?</p>