California Penal Code 29.8
In order to prevail on a defense of insanity, the defendant must show, by a preponderance of the evidence, that, at the time the offense was committed, the defendant was incapable of knowing or understanding the nature of his or her act or of distinguishing right from wrong. (People v. Lawley (2002) 27 Cal.4th 102, 169-170.)
Penal Code Section 29.8, in part, "bars an insanity defense based solely on addiction to or abuse of intoxicating substances." (People v. Cabonce (2009) 169 Cal.App.4th 1421, 1440 referring to section 25.5, which was renumbered 29.8 unaltered.)
Penal Code Section 29.8 provides:
"In any criminal proceeding in which a plea of not guilty by reason of insanity is entered, this defense shall not be found by the trier of fact solely on the basis of a personality or adjustment disorder, a seizure disorder, or an addiction to, or abuse of, intoxicating substances. This section shall apply only to persons who utilize this defense on or after the operative date of the section."