const { Client } = require('pg'); require('dotenv').config({ path: '../.env' }); const client = new Client({ host: process.env.DB_HOST, port: process.env.DB_PORT, user: process.env.DB_USER, password: process.env.DB_PASSWORD, database: process.env.DB_NAME }); client.connect().then(async () => { try { console.log("--- Sample from flaecheneigentuemer_alkis ---"); const alkis = await client.query('SELECT "GNA", "VNA", "FSK" FROM geodaten.flaecheneigentuemer_alkis LIMIT 5'); console.log("Keys in result row:", Object.keys(alkis.rows[0])); console.table(alkis.rows); console.log("\n--- Sample from flaecheneigentuemer_alkis_zuweisung ---"); const zuweisung = await client.query('SELECT * FROM geodaten.flaecheneigentuemer_alkis_zuweisung LIMIT 5'); console.table(zuweisung.rows); console.log("\n--- Checking if names match exactly ---"); // Try a name search with LOWER for testing const nameSearch = await client.query('SELECT count(*) FROM geodaten.flaecheneigentuemer_alkis WHERE "GNA" = $1', [alkis.rows[0].GNA]); console.log(`Searching for "${alkis.rows[0].GNA}": found ${nameSearch.rows[0].count} entries.`); } catch (e) { console.error(e); } finally { client.end(); } });