akretschmer
Datenbank-Guru
- Beiträge
- 10.379
Denn Sinn Deiner Daten zu enträtseln fehlt mir die Zeit. Aber die Antwort auf alle Fragen ist bekanntlich 42. Don't panic!
Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
\d+ patchpanel_equipment
Tabelle „public.patchpanel_equipment“
Spalte | Typ | Attribute | Speicherung | Statistikziel | Beschreibung
-------------+---------+-----------+-------------+---------------+--------------
portid | integer | not null | plain | |
equipmentnr | integer | not null | plain | |
Indexe:
"patchpanel_equipment_portid_key" UNIQUE CONSTRAINT, btree (portid, equipmentnr)
Fremdschlüssel-Constraints:
"patchpanel_equipment_equipmentnr_fkey" FOREIGN KEY (equipmentnr) REFERENCES equipment(serial) ON UPDATE CASCADE ON DELETE CASCADE
alter table patchpanel_equipment add primary key using patchpanel_equipment_portid_key;
FEHLER: Syntaxfehler bei „patchpanel_equipment_portid_key“
ZEILE 1: ... table patchpanel_equipment add primary key using patchpanel...
test=# create table patchpanel_equipment (portid int not null, equipmentnr int not null, unique(portid,equipmentnr));
CREATE TABLE
test=*# \d patchpanel_equipment
Tabelle »public.patchpanel_equipment«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert
-------------+---------+--------------+---------------+-------------
portid | integer | | not null |
equipmentnr | integer | | not null |
Indexe:
"patchpanel_equipment_portid_equipmentnr_key" UNIQUE CONSTRAINT, btree (portid, equipmentnr)
test=*# alter table patchpanel_equipment add primary key using index patchpanel_equipment_portid_equipmentnr_key;
ERROR: index "patchpanel_equipment_portid_equipmentnr_key" is already associated with a constraint
test=*# create table patchpanel_equipment (portid int not null, equipmentnr int not null);
CREATE TABLE
test=*# create unique index patchpanel_equipment_portid_equipmentnr_key on patchpanel_equipment (portid, equipmentnr);
CREATE INDEX
test=# alter table patchpanel_equipment add primary key using index patchpanel_equipment_portid_equipmentnr_key;
ALTER TABLE
test=*# create table patchpanel_equipment (portid int not null, equipmentnr int not null, unique(portid,equipmentnr));
CREATE TABLE
test=*# \d+ patchpanel_equipment
Tabelle »public.patchpanel_equipment«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert | Speicherung | Statistikziel | Beschreibung
-------------+---------+--------------+---------------+-------------+-------------+---------------+--------------
portid | integer | | not null | | plain | |
equipmentnr | integer | | not null | | plain | |
Indexe:
"patchpanel_equipment_portid_equipmentnr_key" UNIQUE CONSTRAINT, btree (portid, equipmentnr)
test=*# commit;
COMMIT
test=# create unique index CONCURRENTLY patchpanel_equipment_portid_equipmentnr_key_unique on patchpanel_equipment(portid, equipmentnr);
CREATE INDEX
test=# alter table patchpanel_equipment add primary key using index patchpanel_equipment_portid_equipmentnr_key_unique;
ALTER TABLE
test=*# \d+ patchpanel_equipment
Tabelle »public.patchpanel_equipment«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert | Speicherung | Statistikziel | Beschreibung
-------------+---------+--------------+---------------+-------------+-------------+---------------+--------------
portid | integer | | not null | | plain | |
equipmentnr | integer | | not null | | plain | |
Indexe:
"patchpanel_equipment_portid_equipmentnr_key_unique" PRIMARY KEY, btree (portid, equipmentnr)
"patchpanel_equipment_portid_equipmentnr_key" UNIQUE CONSTRAINT, btree (portid, equipmentnr)
test=*# alter table patchpanel_equipment drop constraint patchpanel_equipment_portid_equipmentnr_key;
ALTER TABLE
test=*# \d+ patchpanel_equipment
Tabelle »public.patchpanel_equipment«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert | Speicherung | Statistikziel | Beschreibung
-------------+---------+--------------+---------------+-------------+-------------+---------------+--------------
portid | integer | | not null | | plain | |
equipmentnr | integer | | not null | | plain | |
Indexe:
"patchpanel_equipment_portid_equipmentnr_key_unique" PRIMARY KEY, btree (portid, equipmentnr)
test=*#
Wo exakt ist da das Problem? Du kannst alle Befehle in Dateien schreiben und diese Dateien dann in psql source, also ausführen. Die Datein kannst Du in einem Versions-Management verwalten.
Und wenn Du einen SQL-Dump machst (Hint: Backup) bekommst Du exakt dasselbe. Das kann ich also alles sogar völlig automatisieren, und muß nicht in einer GUI rumklicken.
CREATE VIEW Kunden
AS
SELECT
bewegdaten.Id,
bewegdaten.Name,
bewegdaten.Vorname,
stammdaten.OrtName as Ort
FROM Kunden_Archiv bewegdaten
JOIN Orte stammdaten ON bewegdaten.OrtId = stammdaten.Id
WHERE Land='DE'
WITH CHECK OPTION
pg_dump micky_db > pg_dump25.02.2018
Öffnen Sie die Datei "pg_hba.conf" in einem Texteditor.
show hba_file;
andreas@[local]:5433/test*# select setting from pg_settings where name = 'hba_file';;
setting
-------------------------------------
/etc/postgresql/10/main/pg_hba.conf
(1 row)
# /etc/printcap: printer capability database. See printcap(5).
# You can use the filter entries df, tf, cf, gf etc. for
# your own filters. See /etc/filter.ps, /etc/filter.pcl and
# the printcap(5) manual page for further details.
lp|Generic dot-matrix printer entry:\
:lp=/dev/lp0:\
:sd=/var/spool/lpd/lp:\
:af=/var/log/lp-acct:\
:lf=/var/log/lp-errs:\
:pl#66:\
:pw#80:\
:pc#150:\
:mx#0:\
:sh:
# rlp|Remote printer entry:\
# :lp=:\
# :rm=remotehost:\
# :rp=remoteprinter:\
# :sd=/var/spool/lpd/remote:\
# :mx#0:\
# :sh:
LinuxServer~ # su - postgres
postgres@LinuxServer ~ $ psql
Passwort: