Catalyzes the NAD(P)(+)-dependent oxidation of alpha-ketoglutaric semialdehyde (alphaKGSA) to alpha-ketoglutarate. Involved in D-glucarate/D-galactarate metabolism. Prefers NAD(+) to NADP(+) as a cosubstrate. 2,5-dioxopentanoate + H2O + NADP(+) = 2-oxoglutarate + 2 H(+) + NADPH 2,5-dioxopentanoate + H2O + NAD(+) = 2-oxoglutarate + 2 H(+) + NADH kcat is 53.9 sec(-1) with alpha-ketoglutaric semialdehyde as substrate (in the presence of NAD(+)). kcat is 15.4 sec(-1) with alpha-ketoglutaric semialdehyde as substrate (in the presence of NADP(+)). Carbohydrate acid metabolism; D-glucarate degradation. Carbohydrate acid metabolism; galactarate degradation. Homodimer. Induced by D-glucarate and D-galactarate. Belongs to the aldehyde dehydrogenase family.