const { Client } = require('pg'); async function inspect() { 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 }); try { await client.connect(); const tables = [ 'geodaten.flaecheneigentuemer_alkis', 'geodaten.flaecheneigentuemer_alkis_zuweisung', 'geodaten.flaecheneigentuemer_status' ]; for (const table of tables) { const [schema, name] = table.split('.'); console.log(`\n--- Structure of ${table} ---`); const res = await client.query(` SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_schema = $1 AND table_name = $2 ORDER BY ordinal_position; `, [schema, name]); res.rows.forEach(r => console.log(`${r.column_name}: ${r.data_type} (${r.is_nullable})`)); } console.log(`\n--- Views in geodaten ---`); const viewsRes = await client.query(` SELECT table_name FROM information_schema.views WHERE table_schema = 'geodaten'; `); viewsRes.rows.forEach(r => console.log(r.table_name)); } catch (e) { console.error("Error:", e); } finally { await client.end(); } } inspect();