Fix SQL query handling empty string for NULL columns
Deploy Bürgerwind / deploy (push) Successful in 17s Details

This commit is contained in:
Johannes Baumeister 2026-04-29 21:25:58 +02:00
parent 9c8032d511
commit b5c523ab07
1 changed files with 4 additions and 2 deletions

View File

@ -149,9 +149,11 @@ app.post('/api/sicherung', async (req, res) => {
throw new Error(`Projekt '${projekt_id}' konnte nicht gefunden werden.`);
}
// 2. FSKs für den Namen finden
// 2. FSKs für den Namen finden (Behandlung von NULL vs leerem String)
const ownerRes = await client.query(
`SELECT "FSK" FROM ${schema}.flaecheneigentuemer_alkis WHERE "GNA" = $1 AND "VNA" = $2`,
`SELECT "FSK" FROM ${schema}.flaecheneigentuemer_alkis
WHERE ("GNA" = $1 OR ("GNA" IS NULL AND $1 = ''))
AND ("VNA" = $2 OR ("VNA" IS NULL AND $2 = ''))`,
[nachname, vorname]
);