Relator, Public Housing Agency of the City of Bethany, filed a petition for writ of mandamus in this court, seeking to direct Respondent, the Honorable Andrew Krohn, to enter summary judgment in the underlying case of Preston v. Public Housing Agency of the City of Bethany, et al., Case No. 00CV62768. Public Housing’s entitlement to summary judgment depends upon whether sovereign immunity bars Mr. Preston’s suit. The current state of the pleadings would entitle Public Housing to summary judgment because there is no allegation in Mr. Preston’s petition that Public Housing waived sovereign immunity by purchasing liability insurance. Nevertheless, this court exercises its discretion and determines that a writ should not issue because the issues of whether the trial court would grant leave to Mr. Preston to amend his petition to plead waiver and whether there is evidence to support such an amendment are unresolved. Thus, a writ of mandamus compelling Judge Krohn to grant Public Housing’s motion for summary judgement should not issue. This court’s original writ of mandamus, dated May 10, 2002, was improvidently granted, so the preliminary writ is ordered quashed and the request for a permanent writ of mandamus is denied.
Factual and Procedural Background
On December 18, 2000, Marvin Preston filed a petition for damages for wrongful discharge against Public Housing and members of Public Housing’s Board of Directors. He claimed that he was fired from his job as maintenance man after he notified Public Housing and several senators of numerous violations of housing codes, the rental of an apartment to a convicted child molester, and unlawful allocation of housing. He claimed that his termination violated public policy because he was discharged for “whistle-blowing.”
In response, Public Housing and the members of the Board of Directors filed an answer denying that they had wrongfully terminated Mr. Preston for “whistle-blowing.” In addition, they pled, among other defenses, the defenses of sovereign immunity for Public Housing and official immunity for the individually named defendants. Thereafter, Public Housing and the members of the Board of Directors filed a motion for summary judgment, claiming that Public Housing was immune from tort liability under section 537.600,1 RSMo 2000,2 and the individually named defendants were immune from liability because of official immunity. Public Housing claimed it had sovereign immunity because it was a municipal housing authority created by section 99.040.3
*913On July 13, 2001, Judge Krohn heard Public Housing’s motion for summary judgment. Judge Krohn sustained the motion for summary judgment as to the individual defendants. Judge Krohn also granted Mr. Preston thirty days to file an amended petition. In his amended petition, Mr. Preston detailed the Public Housing violations that he reported to Public Housing and again alleged that Public Housing wrongfully terminated him for “whistle-blowing.” Mr. Preston did not dispute or address Public Housing’s claim of sovereign immunity. On December 28, 2001, Judge Krohn denied Public Housing’s motion for summary judgment.
Public Housing filed a writ of mandamus with this court, seeking an order directing Judge Krohn to enter summary judgment in its favor. Public Housing claimed that it was immune from Mr. Preston’s wrongful discharge suit because it has sovereign immunity from tort suits. This court issued a preliminary writ of mandamus. Thereafter, Mr. Preston filed an amended response in opposition to the writ of mandamus, arguing that this court should not grant the writ because Public Housing may have waived sovereign immunity by purchasing liability insurance.
Standard of Review
A writ of mandamus is appropriate “where a court has exceeded its jurisdiction or authority.” State ex rel. Leigh v. Dierker, 974 S.W.2d 505, 506 (Mo. banc 1998). “A writ will he both to compel a court to do that which it is obligated by law to do and to undo that which the court was by law prohibited from doing.” Id.
The denial of a motion for summary judgment asserting the defense of sovereign immunity is reviewed under the same standard of review as an order granting summary judgment. State ex rel. Mo. Highway & Transp. Comm’n v. Dierker, 961 S.W.2d 58, 60 (Mo. banc 1998). Appellate review of summary judgment is “de novo in the light most favorable to the party against whom judgment is sought.” Id. (citing ITT Commercial Fin. Corp. v. Mid-Am. Marine Supply Corp., 854 S.W.2d 371, 376 (Mo. banc 1993)). Summary judgment is appropriate if there are no genuine issues of material fact and the movant is entitled to judgment as a matter of law. ITT, 854 S.W.2d at 381. A defending party may establish a right to judgment as a matter of law by showing:
(1) facts that negate any one of the claimant’s elements facts, (2) that the non-movant, after an adequate period of discovery, has not been able to produce, and will not be able to produce, evidence sufficient to allow the trier of fact to find the existence of any one of the claimant’s elements, or (3) that there is no genuine dispute as to the existence of each of the facts necessary to support the movant’s properly-pleaded affirmative defense.
Id. ‘Where the pleadings show that a defendant is immune from suit as a matter of law, and the trial court refuses to grant summary judgment, a writ of mandamus is appropriate.” State ex rel. Mo. Highway & Transp. Comm’n, 961 S.W.2d at 60.
Public Housing has Sovereign Immunity Unless Waived by Purchase of Liability Insurance
In the underlying action, Mr. Preston brought a claim for wrongful discharge against his former employer, Public Housing, asserting that he was a “whistle blower.” This type of claim was recognized in Brenneke v. Department of Missouri, Veterans of Foreign Wars of the United States of America, 984 S.W.2d 134, 138 (Mo.App.1998), where the court held that when an employer fires “an at-will employ*914ee ‘because the employee reported to his superiors or public authorities serious misconduct that constitutes violations of the law and of such well established and clearly mandated public policy, the employee has a cause of action in tort for damages for wrongful discharge.’ ” (quoting Boyle v. Vista Eyewear, Inc., 700 S.W.2d 859, 878 (Mo.App.1985)).
Generally, when the employer is a public entity, it may be immune from tort liability because of sovereign immunity. Section 537.600. Sovereign immunity applies to actions for retaliatory or wrongful discharge. Duncan v. Creve Coeur Fire Prot. Dist., 802 S.W.2d 205, 207 (Mo.App.1991); Krasney v. Curators of Univ. of Mo., 765 S.W.2d 646, 650 (Mo.App.1989). The Missouri Supreme Court has ruled that a housing authority organized under section 99.040, like Public Housing, is entitled to sovereign immunity under section 537.600. Uptergrove v. Hous. Auth. of City of Lawson, 935 S.W.2d 649, 653 (Mo.App.1996) (citing State ex rel. St. Louis Hous. Auth. v. Gaertner, 695 S.W.2d 460 (Mo. banc 1985)).
In certain circumstances, sovereign immunity has been waived by the legislature. The legislature waived sovereign immunity “for torts arising out of (1) the negligent operation of motor vehicles by public employees and (2) the dangerous condition of a public entity’s property.” Brennan By and Through Brennan v. Curators of the Univ. of Mo., 942 S.W.2d 432, 434 (Mo.App.1997). See also § 537.600.1; Uptergrove, 935 S.W.2d at 653. In addition, under section 537.610.1, “when a public entity purchases liability insurance or duly adopts a self-insurance plan for tort claims, sovereign immunity is waived to the extent of the amount provided and for the specific purposes set forth in the insurance plan.”4 Langley v. Curators of the Univ. of Mo., 73 S.W.3d 808, 811 (Mo.App.2002). The statutory provisions waiving sovereign immunity are construed in favor of the state “to preserve the state’s sovereign rights and protect its capacity to perform necessary governmental functions.” Krasney, 765 S.W.2d at 650.
In this writ proceeding, Mr. Preston concedes that his cause of action for wrongful discharge against Public Housing would be barred by sovereign immunity unless sovereign immunity was waived. He concedes that his claim does not fall within the motor vehicle or dangerous property statutory waivers of sovereign immunity. Mr. Preston claims, instead, that Public Housing waived sovereign immunity, under section 537.610, by purchasing liability insurance to cover the acts of which Mr. Preston complains in his petition. Mr. Preston argues that because the issue of whether Public Housing purchased liability insurance to cover his claim is unresolved, summary judgment is not appropriate. Public Housing asserts that, because Mr. Preston did not plead a waiver of sovereign immunity by the purchase of liability insurance and only raised this argument in his amended response to the writ of mandamus, the issue of liability insurance is not in dispute and, therefore, Public Housing is entitled to summary judgment.
The arguments of Mr. Preston and Public Housing raise the issue of which party has the burden of pleading and proof for a claim of sovereign immunity. While this court held that sovereign immunity is an affirmative defense that must be pled by the defendant in Greene County v. State, 926 S.W.2d 701 (Mo.App.1996), this court subsequently noted that, “other than *915Greene County, there is little authority” for the proposition that sovereign immunity is an affirmative defense. Brennan, 942 S.W.2d at 436. As a result, the Brennan court ruled contrary to the holding of Greene County that, under circumstances similar to those in this case, the plaintiff must plead and prove a waiver of sovereign immunity by the purchase of liability insurance. Id. (holding “the only way for appellants to penetrate the Curators’ immunity is to demonstrate the existence of the General Liability Plan and that it covers the claims asserted by appellants against the Curators.”).
Under the rule of Brennan, Mr. Preston’s claim of retaliatory discharge would be barred by sovereign immunity because he has not pled, in his amended petition, that Public Housing waived sovereign immunity by the purchase of liability insurance. Thus, Public Housing shows an entitlement to summary judgment. See ITT, 854 S.W.2d at 381. Nevertheless, Public Housing does not have an entitlement to a writ of mandamus. State ex rel. Mason v. County Legislature, 75 S.W.3d 884, 887 (Mo.App.2002). “Mandamus is a discretionary writ, and no right exists to have the writ issue.” Id. Although Mr. Preston has not yet raised in the trial court the issue of whether Public Housing waived sovereign immunity by purchasing liability insurance, the trial court’s denial of Public Housing’s motion for summary judgment gives Mr. Preston the opportunity to seek leave to plead waiver and pursue discovery to determine if there is evidence to support a waiver. As such, this court exercises its discretion and will not intervene to compel the trial court to grant summary judgment while this issue is still unresolved.
Anticipating this result, Public Housing argues that “even if this Court was inclined to overlook [Mr.] Preston’s failure to raise the purchase of liability insurance, [it] is still entitled to summary judgment” because Mr. Preston did not request additional time to serve discovery on the issue of liability insurance or to amend his pleading. The authority Public Housing relies on in support of this position holds that “[t]he trial court is not required to sua sponte grant leave to a party to amend a deficient petition.” Fantasma v. Kansas City, Mo., Bd. of Police Comm’rs, 913 S.W.2d 388, 392 (Mo.App.1996). This case does not hold, however, that an appellate court should grant an extraordinary writ compelling summary judgment, which would, in effect, preclude the trial court from considering whether to grant leave to a party to amend a deficient pleading. Mr. Preston is not arguing that the trial court should, sua sponte, grant him leave to serve discovery or amend his deficient pleading. Instead, he is arguing that a writ is improper to compel summary judgment because the issue of whether Public Housing waived sovereign immunity by purchasing liability insurance remains. This court agrees. The trial court should have the opportunity to exercise its discretion to rule on any motion for leave to amend and any request for discovery that may be filed by Mr. Preston.
The preliminary writ of mandamus is quashed and the request for a permanent writ of mandamus is denied.
All concur.
."The legislature reinstated sovereign immunity in 1987 by enacting section 537.600, [RSMo 1994,] after the Missouri Supreme Court abrogated the doctrine in Jones v. State Highway Comm’n, 557 S.W.2d 225 (Mo. banc 1977).” Uptergrove v. Hous. Auth. of City of Lawson, 935 S.W.2d 649, 652 (Mo.App.1996). Section 537.600 states that "[s]uch sovereign or governmental tort immunity as existed at common law in this state prior to September 12, 1977, except to the extent waived, abrogated or modified by statutes in effect prior to that date, shall remain in full force and effect[.]”
. All statutory references are to the Revised Statutes of Missouri 2000.
. Section 99.040.1 provides that "[i]n each city (as herein defined) and in each county of the state there is hereby created a municipal corporation to be known as the 'Housing Authority’ of the city or county[J”
. Section 537.610.2 imposes a maximum amount of waiver of $2,000,000 per single accident or occurrence and $300,000 for any one person.