So i have created a table with multiple columns to collect some information about a database
CREATE TABLE DATENBANKEN (
ID serial,
name VARCHAR(20),
Erstellt timestamp,
Datenbankgröße VARCHAR(20),
"Collation" VARCHAR (20),
Beschreibung VARCHAR (50)
)
and with the following insert statement i was able to fill the rows with the desired information
INSERT INTO DATENBANKEN (id, name, Erstellt, Datenbankgröße, "Collation")
SELECT pg_database.oid,
pg_database.datname,
(pg_stat_file('base/'||pg_database.oid ||'/PG_VERSION')).modification,
pg_size_pretty(pg_database_size(datname)),
pg_database.datcollate datcollate from pg_database
all the values above were captured from on table (pg_database)
now the last value "Beschreibung" is located in another table named (pg_shdescription)
so in this case i had to make another insert statement specifically for the column "Beschreibung"
INSERT INTO DATENBANKEN (Beschreibung)
select pg_shdescription.description from pg_shdescription
what did i do wrong here or what is the best way to insert certain data from different tables into a new table that are still linked together?
I really appreciate your help, any help