Argued and submitted December 12, 2007,

reversed and remanded June 11,

petition for review allowed October 15, 2008 (345 Or 381)

#### STATE ex rel Susan DEWBERRY; Carole Holcombe; Suzanne Danielson; and Arnold Buchman, *Relators-Appellants, v.*The Honorable Theodore R. KULONGOSKI, Governor of the State of Oregon; and other Executive Officers in the State of Oregon, *Defendants-Respondents.*

Lane County Circuit Court

160323044; A124001

187 P3d 220

*346-bKelly Clark argued the cause for appellants. With him on the opening brief were Kristian Roggendorf and O’Donnell & Clark LLP. With them on the reply brief was Jill Odell.

Kaye E. McDonald, Senior Assistant Attorney General, argued the cause for respondents. With her on the brief were Hardy Myers, Attorney General, Mary H. Williams, Solicitor General, and Stephanie Striffler, Special Counsel to the Attorney General.

Before Haselton, Presiding Judge, and Armstrong, Judge, and Rosenblum, Judge.

HASELTON, P. J.

*347HASELTON, P. J.

Relators appeal from a judgment dismissing their petition for an alternative writ of mandamus. They argue that the trial court erred in concluding that they failed to establish that they do not have a “plain, speedy and adequate remedy in the ordinary course of the law,” ORS 34.110, and that the trial court misapplied ORCP 29 and ORS 28.110 in the present proceeding. As explained below, we agree with relators in certain respects, albeit at some points for reasons not advanced by the parties, and conclude that relators did not have a “plain, speedy and adequate remedy in the ordinary course of the law,” ORS 34.110, in the form of a declaratory judgment action. Accordingly, we reverse and remand.

The procedural background of this case is convoluted. In early 2003, the Governor of Oregon entered into a compact with the Confederated Tribes of Coos, Lower Umpqua, and Suislaw Indians (the Confederated Tribes) to permit those tribes to open a casino near Florence, Oregon. In September 2003, relators filed a petition for writ of mandamus against the Governor in the Oregon Supreme Court, which was denied.

On December 10,2003, relators filed this mandamus proceeding in the Lane County Circuit Court, naming the Governor and other executive officers of the state as defendants (hereinafter referred to as the state). The gravamen of relators’ complaint was that the Governor, by executing the compact with the Confederated Tribes, had contravened Article XV, section 4(12), of the Oregon Constitution, which provides that “[t]he Legislative Assembly has no power to authorize, and shall prohibit, casinos from operation in the State of Oregon.”

The state moved to dismiss relators’ complaint, arguing, first, that relators had failed to demonstrate that they were entitled to mandamus relief, because they had a plain, speedy, and adequate remedy at law — specifically, that they could, in fact, pursue an action under the Uniform Declaratory Judgments Act (ORS 28.010 to 28.160). The *348state further argued that relators’ proceeding should be dismissed, because they failed to join the Confederated Tribes as a necessary party defendant.

The trial court agreed, and dismissed the petition. In so ruling, the trial court began by noting that a writ of mandamus “shall not be issued in any case where there is a plain, speedy and adequate remedy in the ordinary course of the law.” ORS 34.110. The court continued, concluding that the relators had failed to establish that declaratory relief was not an available adequate remedy:

> “A declaratory judgment action is by nature plain and speedy. Accordingly, the question for the court is whether such a remedy is ‘adequate.’

> “ORS 28.110 provides in part that ‘[w]henever declaratory relief is sought, all persons shall be made parties who have or claim any interest which would be affected by the declaration, and no declaration shall prejudice the rights of persons not parties to the proceeding.’

> “Plaintiffs-Relators argue that because the declaratory judgment statute requires joinder of any party who may be affected by a declaration of the court, in this case the Confederated Tribes, and because as ‘domestic dependent nations’ the Tribes are insulated from claims brought in state courts, that requiring Plaintiffs-Relators to pursue a declaratory relief action would leave Plaintiffs-Relators with no possible remedy. Hence, Plaintiffs-Relators argue, a declaratory judgment action is not ‘adequate’ within the meaning of ORS 34.110.

> “At this juncture, this court cannot determine if a declaratory remedy would be adequate because it does not know the position of the Confederated Tribes. It is the Plaintiff-Relators’ burden to convince this court that a declaratory remedy is not adequate and they have failed to do so.”

(Citation and footnote omitted.) The court further concluded that ORCP 29 A applied in the mandamus context:

> “Plaintiffs-Relators argue that the Oregon Rules of Civil Procedure do not apply to a mandamus action. * * * I conclude that the Oregon Rules of Civil Procedure do apply to mandamus actions.

> *349“The court concludes that pursuant to both ORS 28.110 and ORCP 29 A the Confederated Tribes are a necessary party. The Confederated Tribes interest would most certainly be affected if the compact were found to be invalid. * * * ORCP 29 A requires that the Confederated Tribes must be joined in this action. The mere fact that a tribe has sovereignty is irrelevant at this juncture. The Confederated Tribes may assent to this court’s jurisdiction. Alternatively, the Confederated Tribes, when properly joined, may assert its sovereignty. At this time, the court has no way of knowing in which way the Confederated Tribes will choose to proceed.

> “Because the proper remedy for Plaintiffs-Relators is a declaratory judgment, and the Confederated Tribes have an interest which would be affected by the declaration, and the law is clear that no declaratory judgment shall prejudice the rights of persons not parties to the proceeding, namely the Confederated Tribes, the Confederated Tribes are a necessary party and should be joined.”

The trial court, consequently, granted the state’s motion to dismiss. Thereafter, relators appealed the dismissal but successfully moved to hold the appeal in abeyance pending the resolution of a declaratory judgment action.

In March 2004, relators initiated their action in state court pursuant to the Uniform Declaratory Judgments Act, naming the state as well as the Confederated Tribes as defendants, and arguing that the Confederated Tribes had waived their sovereign immunity pursuant to the Indian Gaming Regulatory Act (IGRA), 25 USC §§ 2701 - 2721. The state then removed the case to federal court, where it was dismissed in December 2005, based on the district court’s conclusion that the plaintiffs in that case (relators here) lacked standing and that the Confederated Tribes had sovereign immunity.1

Relators thereafter reactivated this appeal, contending, in part, that the federal court’s dismissal of their declaratory judgment action demonstrated that declaratory relief *350was not, in fact, an adequate available remedy at law — and, hence, the trial court had erred in dismissing the mandamus proceeding.

We turn to the parties’ specific arguments on appeal. We first briefly address — and reject — relators’ argument that the trial court committed a procedural error by entertaining, and deciding, the state’s motion to dismiss without having first issued an alternative writ. Without belaboring the point, we note that the trial court did not follow the precise procedure set forth in ORS 34.130 and ORS 34.170. We conclude, however, that the error was entirely harmless, as the error did not deprive any party of the ability to present its position fully to the trial court. Accordingly, we reject relators’ argument that the trial court’s default in that regard constituted reversible error.

Relators advance two other, principal arguments. First, relators assert, the trial court erred in concluding that they had failed to establish that they did not have a “plain, speedy and adequate remedy in the ordinary course of the law.” ORS 34.110. Second, they assert that the trial court erred in concluding that ORCP 29, concerning joinder of parties, applies to mandamus proceedings.

The state responds that relators had a plain, speedy, and adequate remedy in the form of a declaratory judgment action, that ORCP 29 does apply to mandamus proceedings, and that, in any event, this court should affirm the trial court’s ruling on the alternative bases of issue preclusion or claim preclusion. Finally, the state suggested at oral argument that this court should not view the trial court’s opinion as relying on ORCP 29 for its disposition, but that we should, instead, view the trial court’s statements concerning that rule simply as context for its conclusion that relators had a plain, speedy, and adequate remedy in the ordinary course of the law.

Normally, we would proceed directly to a dispositive assignment of error and forgo discussion of the remaining assignments. In this case, however — although we ultimately disagree with the trial court’s conclusion that relators had a “plain, speedy and adequate remedy in the ordinary course of the law,” ORS 34.110 — we find that we must address the *351other issues, as well. That is so because the parties’ arguments as to who must be parties to mandamus and declaratory judgment proceedings are inextricably intertwined with the resolution of the ultimate question of whether relators had a “plain, speedy and adequate remedy in the ordinary course of the law.” ORS 34.110.

We begin with the issue of whether ORCP 29 applies to mandamus proceedings. Although the state now appears to be disavowing a portion of the trial court’s analysis — or, at least, urging us to view the trial court’s ruling as not being premised on its application of ORCP 29 in this case — we do not think the trial court’s decision is properly susceptible to such a reading. The state, in its motion to dismiss, advanced “failure to join a necessary part/’ as an independently sufficient basis for dismissal, distinct from its argument that relators had not demonstrated that they did not have a sufficient remedy at law. The trial court adopted each of those alternative arguments, specifically concluding with respect to ORCP 29 that “the Oregon Rules of Civil Procedure do apply to mandamus actions” and that “ORCP 29 A requires that the Confederated Tribes must be joined *in this action.”*(Emphasis added.) For the reasons that follow, we conclude that, regardless of the applicability of other provisions of the Oregon Rules of Civil Procedure to mandamus proceedings, the trial court erred in concluding that ORCP 29 A applied to this proceeding.

ORCP 1 A indicates that the Oregon Rules of Civil Procedure govern procedure and practice in circuit courts “for all civil actions and special proceedings whether cognizable as cases at law, in equity, or of statutory origin *except where a different procedure is specified by statute*or rule.” (Emphasis added.) ORCP 29 provides, in pertinent part:

> “A. Persons to be joined if feasible. A person who is subject to service of process shall be joined as a party in the action if (1) in that person’s absence complete relief cannot be accorded among those already parties, or (2) that person claims an interest relating to the subject of the action and is so situated that the disposition in that person’s absence may (a) as a practical matter impair or impede the person’s ability to protect that interest or (b) leave any of the persons already parties subject to a substantial risk of incurring *352double, multiple, or otherwise inconsistent obligations by reason of their claimed interest. If such person has not been so joined, the court shall order that such person be made a party. If a person should join as a plaintiff but refuses to do so, such person shall be made a defendant, the reason being stated in the complaint.

> “B. Determination by court whenever joinder not feasible. If a person as described in subsections A(l) and (2) of this rule cannot be made a party, the court shall determine whether in equity and good conscience the action should proceed among the parties before it, or should be dismissed, the absent person being thus regarded as indispensable. The factors to be considered by the court include: first, to what extent a judgment rendered in the person’s absence might be prejudicial to the person or those already parties; second, the extent to which, by protective provisions in the judgment, by the shaping of relief, or other measures, the prejudice can be lessened or avoided; third, whether a judgment rendered in the person’s absence will be adequate; fourth, whether the plaintiff will have an adequate remedy if the action is dismissed for nonjoinder.”

Thus, in general, ORCP 29 A defines “necessary” parties, and ORCP 29 B pertains to whether an absent “necessary” party is so “indispensable” that the failure or inability to join that person precludes the prosecution of an action. Relators maintain that ORCP 29 A does not apply in mandamus proceedings because the mandamus statutes specify “a different procedure,” ORCP 1 A, for parties to a mandamus proceeding. We agree.

ORS 34.105 to 34.240 govern mandamus proceedings. As noted, ORS 34.110 provides that the “writ shall not be issued in any case where there is a plain, speedy and adequate remedy in the ordinary course of the law.” Thus, relators must demonstrate that such a “plain, speedy and adequate remedy’ is *not*available. *Cf. Mt. Hood Stages v. Haley,*253 Or 28, 38-39, 445 P2d 878, 453 P2d 435 (1969) (suggesting that mandamus relators are to plead inadequacy of remedy).

ORS 34.105 provides the following operative definitions:

> *353“As used in ORS 34.105 to 34.240:

> “(1) ‘Adverse party means a beneficially interested party to a judicial or administrative proceeding from which a mandamus proceeding arises, whose interests are adverse to the relator.

> :{: if: íjí *%*

> “(3) ‘Defendant’ means the court, corporation, board, officer or person against whom relief is sought in a mandamus action.

> “(4) ‘Relator’ means the beneficially interested party on whose relation a mandamus proceeding is brought.”

ORS 34.110 provides that a writ of mandamus may be issued “to any inferior court, corporation, board, officer or person, to compel the performance of an act which the law specifically enjoins, as a duty resulting from an office, trust or station[.]” In the present action, as noted, relators sought a writ against the Governor and state officials “[t]o ensure that no state agency or any executive officer will take any action in furtherance of the compact [with the Confederated Tribes] on behalf of the state [.]” In sum, relators sought to compel state officials to uphold the Oregon Constitution “a duty [that] result[s]” from their offices. ORS 34.110.

ORS 34.130(2) provides for the service of the petition for a writ on the “defendant” and, if the matter “arises from a judicial or administrative proceeding,” on “adverse partfies]” as well. ORS 34.130(4)(a) provides that an “adverse party’ may *“intervene*in the mandamus proceeding as a matter of right” (emphasis added) at any time until the return date of the alternative writ and, thereafter, may intervene only with leave of the court.

Those provisions differ in substance from the provisions of ORCP 29 that are quoted above. ORCP 29 A prescribes the joinder, as parties, of a broad class of persons— including persons “claim [ing] an interest relating to the subject of the action” whose “ability to protect that interest” may be “impaired] or impede[d]” by a disposition in their absence. Conversely, under ORS 34.110 to 34.130, the only required parties to a mandamus are a “relator” and a “defendant.” Other persons whose interests may be substantially affected *354by the disposition of the mandamus proceedings *can*participate in those proceedings — but only if they satisfy the definition of “adverse party,” ORS 34.105(1), and, even then, only by way of intervention. ORS 34.130(4). That is, under the mandamus statutes, the class of “defendants” is narrowly circumscribed, and, unlike under ORCP 29 A, it is incumbent upon other, potentially adversely affected persons to *intervene*in the proceeding, rather than for relators to *join*such persons. Further, under the mandamus statutes, unlike ORCP 29 B, there are no provisions for considering anyone other than relators and defendants to be “indispensable” in a mandamus proceeding.

In sum, the mandamus statutes specify different procedures and different substantive requirements than ORCP 29 for the naming and joinder of parties in a mandamus proceeding. Accordingly, ORCP 29 does not apply in mandamus proceedings. ORCP 1 A. The trial court thus erred in concluding, under ORCP 29 A, that the Confederated Tribes were a “necessary part/’ “who must be joined in this action.”2

We turn, then, to the trial court’s alternative rationale for dismissal, *viz.,*that mandamus does not lie because relators failed to establish the absence of a “plain, speedy and adequate” alternative remedy — and, specifically, that relators had failed to show that declaratory relief was not such a remedy. Relators challenge that conclusion:

> “A declaratory judgment action could not possibly provide Plaintiffs-Relators with a plain, speedy, and adequate remedy because — as the United States District Court found — the Tribes would be a necessary party since they have interests which would be affected by a declaration that the Governor did not have authority to enter into the compact. Because the Tribes have sovereign immunity, any such declaratory judgment action would have to be dismissed, which is what ultimately occurred in federal court.”

As an initial matter, we reject relators’ implicit invitation that we base our conclusion about the propriety of the *355trial court’s disposition of *this*action on the mere fact that relators did not ultimately prevail in their declaratory judgment action in federal court.3 That approach partakes, impermissibly, of “20/20 hindsight.” Rather, in reviewing the correctness of the trial court’s dismissal — which was, of course, entered long before the federal court disposed of the subsequent declaratory judgment case — we must do so based on the record before the trial court at the time it ruled. Specifically, as of *that*time, did the trial court err in concluding that relators had failed to show that a declaratory judgment action under the Uniform Declaratory Judgments Act would not provide them with a “plain, speedy and adequate remedy in the ordinary course of the law,” ORS 34.110?

As amplified below, we conclude that the trial court erred in its resolution of that question. That is so because of the combination of two circumstances: (1) the Confederated Tribes’ participation in the declaratory judgment action was a jurisdictional prerequisite to the availability of an adjudication on the merits of that action and (2) the satisfaction of that prerequisite was a matter entirely within the Confederated Tribes’ — and not relators’ — control.

We turn to the prerequisites for obtaining declaratory relief under Oregon’s codification of the Uniform Declaratory Judgments Act, ORS 28.010 to 28.160.4 ORS 28.110 provides, in part:

> “When declaratory relief is sought, all persons shall be made parties who have or claim any interest which would *356be affected by the declaration, and no declaration shall prejudice the rights of persons not parties to the proceeding.”

That provision has long been held to be a jurisdictional requirement. *See, e.g., Stanley, Adm. v. Mueller,*211 Or 198, 315 P2d 125 (1957).

In *Stanley, Adm.,*the administrator of an estate brought an action against the decedent’s surviving husband, seeking a declaration that before her death, decedent and her husband had entered into an agreement that neither would make a claim on the estate of the other. *Id.*at 200. The trial court entered a declaration for the defendant husband, and, on appeal, the Supreme Court concluded that the controversy was not justiciable because the decedent’s legatees under her will were not parties to the declaratory judgment action. *Id.*at 201-10.

In reaching that conclusion, the Supreme Court interpreted ORS 28.110. Referring to decisions from numerous other jurisdictions that had enacted the Uniform Declaratory Judgments Act, the court concluded that the courts could not adjudicate a controversy without the presence of all adverse parties. In particular, the Supreme Court focused on the “shall” language of ORS 28.110 (“all persons *shall*be made parties” (emphasis added); “no declaration *shall*prejudice the rights of persons not parties” (emphasis added)), reading those provisions as mandatory. *Stanley, Adm.,*211 Or at 208. The court continued:

> “Where the rights of parties with an interest are left undetermined the uncertainty and insecurity will remain and ‘courts properly decline to make declarations between parties when others, not bound, might later raise the identical question and deprive the declaration of that final and pacifying function it is calculated to subserve.’ Borchard[, *Declaratory*Judgments] at 256-257.

> “We find nothing in the Declaratory Judgments Act, considered in its entirety and in the light of its expressed purpose, which warrants us in adopting a construction contrary to the mandatory language of ORS 28.110. And, since it is clear that the section was intended to protect the rights of all parties having or claiming an interest which would be *357affected by the declaration sought, we are satisfied that an imperative construction is the only admissible one.”

*Id.*at 209. The Supreme Court finally noted that the requirements of ORS 28.110 could not be waived, and that, in the absence of the legatees, the trial court “had no authority under the Declaratory Judgments Act to enter a decree declaring the rights of the parties.” *Id.*at 210.

Subsequent decisions have consistently reiterated that a court cannot enter a declaration under the Uniform Declaratory Judgments Act unless all persons who have an affected interest are before it. *Vance v. Ford,*187 Or App 412, 67 P3d 412 (2003), is exemplary. There, a declaratory judgment was entered concerning certain property owners’ rights to use a private road. *Id.*at 414. One of the parties raised, in the first instance on appeal, an argument that the trial court lacked jurisdiction because another property owner had not been joined in the action. We agreed, and further agreed that the matter was jurisdictional and could be raised in the first instance on appeal. *Id.*at 423-24. We then determined that, although the court’s declaration did not explicitly purport to adjudicate the absent person’s interest, “to determine the extent of defendants’ rights to use the roadway, the trial court necessarily had to determine the extent of [the absent landowner’s] ownership.” *Id.*at 424. Further, we rejected the plaintiffs’ argument that their noncompliance with ORS 28.110 was, essentially, harmless, because the trial court’s declaration was “not binding” on the absent property owner:

> “Although that may be true, the requirement that ‘no declaration shall prejudice the rights of persons not parties to the proceeding’ implements, but does not obviate, the mandate in the first clause of ORS 28.110 requiring joinder of all ‘who have or claim any interest which would be affected by the declaration.’ * * * *The requirement that all interested parties be joined in a declaratory judgment action serves a broader purpose than the protection of an absent party’s interests. It also protects the certainty of the judgment itself.”*

*Id.*(citations omitted; first emphasis in original; second emphasis added). *See also Wright v. Hazen Investments, Inc.,*293 Or 259, 264, 648 P2d 360 (1982) (ORS 28.110 requires *358“joinder of all affected interests in order to yield jurisdiction to enter a declaratory judgment”).

Thus, ORS 28.110 requires, as a *jurisdictional*matter, that all parties who claim or have an interest that would be affected by the declaration must be parties to the declaratory judgment action. That requirement is more rigorous than ORCP 29 A, which, in some instances, permits a court to proceed in the absence of a person that has “an interest relating to the subject of the action.” That jurisdictional requirement, as we emphasized in *Vance,*is imposed, in part, to “protect ] the certainty of the judgment itself,” *Vance,*187 Or App at 424, from the effect of inconsistent adjudications resulting from subsequent or collateral litigation involving absent interested parties. That purpose is not served, and that requirement is not satisfied, when an interested party, albeit initially joined, invokes sovereign immunity so as to avoid an adjudication on the merits. The declaratory judgment cannot proceed in such circumstances — that is, in the absence of the interested immune party — because to do so would create the manifest potential for subsequent inconsistent judgments, subverting “the certainty of the judgment itself,” *id.,*which ORS 28.110 is designed to preclude.

The state argues, and the trial court appears to have agreed, that the mere possibility that an entity with sovereign immunity *might*choose not to invoke its immunity and, instead, to participate in a declaratory judgment action meant that relators had a sufficient alternative remedy at law. We disagree. The state correctly asserts that, for purposes of determining whether mandamus will lie, a remedy may be considered “adequate” even if it does not afford the plaintiffs all of the relief they seek, *see State ex rel Market v. Keisling,*314 Or 235, 838 P2d 585 (1992), and even if, as a practical matter, it is unlikely that the plaintiffs can, in fact, prevail in an action seeking the alternative remedy. *See State ex rel Reid v. Frohnmayer,*93 Or App 444, 763 P2d 733 (1988); *Mongelli v. Oregon Life and Health Guaranty,*85 Or App 518, 737 P2d 633 (1987).

The problem with the state’s position is that none of those cases — nor any other case of which we are aware— *359holds that a plaintiff has a “plain, speedy and adequate remedy in the ordinary course of the law,” ORS 34.110, under circumstances in which the availability of an adjudication on the merits is entirely within the control of an adverse party. That is undisputably the case here. As a matter of jurisdiction, the declaratory judgment action could not proceed to adjudication on the merits in the absence of the Confederated Tribes, who, as signatories of the 2003 compact, have an interest that would be affected by a declaration that the Governor and state officials are precluded by the Oregon Constitution from adhering to the compact. *Cf. Nolan v. Jackson National Life Ins. Co.,*155 Or App 420, 963 P2d 162 (1998), *rev den,*328 Or 275 (1999) (when declaratory judgment concerns a contract, all parties to the contract are necessary). Further, the Confederated Tribes, by virtue of their sovereign immunity, unilaterally controlled their participation — and, hence, the availability of declaratory relief.

In sum, relators’ ability, as plaintiffs in the declaratory judgment action, to pursue and obtain declaratory relief was completely controlled by an adverse party. In those circumstances, a declaratory judgment action afforded neither a “plain” nor “adequate” remedy. ORS 34.110. Accordingly, the trial court erred in concluding that mandamus did not lie because relators had failed to show that they lacked a “plain, speedy and adequate remedy in the ordinary course of the law.” ORS 34.110.

We proceed, finally, to the state’s proposed alternative basis for affirming the trial court’s *decision*— viz., claim preclusion. Specifically, the state asserts that the issues that relators seek to litigate have already been litigated in the federal court proceeding described above.5 In that regard, the state asks us to take judicial notice of the federal court’s opinion in *Dewberry v. Kulongoski,*406 F Supp 2d 1136, 1140 (D Or 2005), which, as noted, *see*220 Or App at 349 n 1, was dismissed based on the court’s conclusions that the plaintiffs lacked standing and the Confederated Tribes had sovereign *360immunity from suit, and contained alternative rationales for the disposition, including a rejection of the merits of the plaintiffs’ claims.

Relators respond that claim preclusion is not a proper alternative basis for affirmance, because there must be a basis in the trial court record to support such an affirmance, and such a record was not made here (and, indeed, could not have been made, given that the federal case had not even been initiated at the time of the trial court’s decision).6 As explained below, we conclude that the state’s asserted alternative basis for affirmance is not properly cognizable here.

Whether to affirm a trial court’s ruling on an alternative basis is a matter within the appellate court’s discretion. *Outdoor Media Dimensions Inc. v. State of Oregon,*331 Or 634, 659, 20 P3d 180 (2001). The exercise of that discretion is inappropriate where the record developed below might have developed differently if the alternative basis had been raised. *Id.*

Claim preclusion is an affirmative defense. *Aguirre v. Albertson’s, Inc.,*201 Or App 31, 49, 117 P3d 1012 (2005). As such, it must be pleaded by a defendant. ORCP 19 B. Moreover, it is a defense that can be waived if it is not timely raised. *Aguirre,*201 Or App at 49-50. Here, not only was claim preclusion not raised as an affirmative defense in the trial court, but it *could not*have been raised because, as noted, the basis for the state’s claim preclusion *argument*— viz., the federal court’s *subsequent*disposition — did not exist when the present case was in the trial court. Thus, not only was the putative affirmative defense not pleaded, but no record in support of, or in opposition to, that affirmative defense was made, or could have been made, in the trial court.

*Fox v. Collins,*213 Or App 451, 458-59, 162 P3d 998, *rev den,*343 Or 223 (2007), is closely analogous. There, a defendant who had prevailed on a preclusion defense in the *361trial court sought to raise, as an alternative basis for affirmance, a new affirmative defense concerning the statute of limitations. We observed:

> “Here, because defendants did not assert a statute of limitations defense in their pleadings, the record before the trial court would not have supported a dismissal of plaintiffs claims on that basis. The court may not *sua sponte*consider a statute of limitations defense that is not pleaded. *See Francke v. Gable,*121 Or App 17, 20, 853 P2d 1366 (1993) (trial court’s dismissal of action on its own motion on basis of unasserted, waivable defense is plain error); *Palmer v. State of Oregon,*121 Or App 377, 380, 854 P2d 955 (1993), *aff'd,*318 Or 352, 867 P2d 1368 (1994) (declining to affirm post-conviction court’s dismissal of plaintiffs petition for post-conviction relief on alternative basis that it was untimely where state waived statute of limitations by failing to raise it by answer or motion to dismiss the petition); *cf. Waddill v. Anchor Hocking, Inc.,*330 Or 376, 384, 8 P3d 200 (2000) (because defense of failure to state a claim under ORCP 21 G(3) is waivable by party’s failure to timely assert it, the appellate courts will not consider legal sufficiency of claim on appeal unless such a challenge was raised at trial). We therefore reject defendants’ statutory arguments as an alternate ground for affirmance.”

*Id.*at 461. So too here. We therefore reject the state’s alternative basis for affirmance.

The trial court erred in dismissing relators’ petition.

Reversed and remanded.

1

 After concluding that the case must be dismissed on those jurisdictional bases, the federal district court proceeded, nevertheless, to address the merits of the plaintiffs’ claims, opining that the Governor did, in fact, have authority to enter into the compact. *Dewberry v. Kulongoski,*406 F Supp 2d 1136 (D Or 2005).

2

 It is undisputed that the Confederated Tribes could not be named as “defendants” in the mandamus proceeding, because they have no “duty resulting from an office, trust or station” that relators believe is not being carried out. ORS 34.110.

3

 We note in passing that the federal court did not, in fact, construe or apply Oregon’s Declaratory Judgments Act, but rather simply stated that “[allthough plaintiffs couch their claims in terms of a declaratory action under state law, at its core, this lawsuit challenges the validity of the Tribes’ Compact under the provisions of IGRA.” *Dewberry,*406 F Supp 2d at 1140.

4

 The parties, in addressing, and disputing, whether the Confederated Tribes’ joinder and participation in the declaratory judgment action was a prerequisite to the availability of declaratory relief, have assumed that that matter is governed by the necessary party/indispensable party formulation of ORCP 29 A and ORCP 29 B. That assumption is incorrect. Oregon’s declaratory judgment law — in particular, ORS 28.110 — has its own provisions concerning who must he a party to a declaratory judgment action. Moreover, as explained below, that statute and case law interpreting it provide a significantly different analysis of the question than the analysis called for under ORCP 29.

5

 The state, in its arguments, does not appear to distinguish between issue preclusion and claim preclusion. Given the cases that the state cites, we understand its argument to be based on claim preclusion. *See generally Drews v. EBI Companies,*310 Or 134, 140-41, 795 P2d 531 (1990) (explaining differences between issue preclusion and claim preclusion).

6

 Relators further argue that the state should be barred, by judicial estoppel, from raising their present preclusion argument, because it directly conflicts with a position that the state took earlier in this litigation. Given our analysis and disposition, we do not reach that contention.