Catalyzes the NAD(P)(+)-dependent oxidation of alpha-ketoglutaric semialdehyde (alphaKGSA) to alpha-ketoglutarate in the D-glutarate degradation pathway. 2,5-dioxopentanoate + H2O + NADP(+) = 2-oxoglutarate + 2 H(+) + NADPH Carbohydrate acid metabolism; D-glucarate degradation. Belongs to the aldehyde dehydrogenase family.