wie krieg ich die DDL aller Tabellen eines Schemas inkl. Indizes, Trigger etc.

in ein File um daraus auf einem anderen Server, selbiges zu kreieren?

Herzliche Grüße
Hans

mache einen schema-dump. -s bzw. --schema-only in der man-page zu pg_dump sind Deine Freunde.

Andreas

Danke Andreas.

Lösung des Problems, falls jemand die Spaltendefinitionen benötigt:

select relname, attname, typname,
CASE
when typname= ‘int8’ THEN attlen
when typname= ‘int4’ THEN attlen
when typname= ‘int2’ THEN attlen
when typname= ‘date’ THEN attlen
when typname= ‘time’ THEN attlen
when typname= ‘timestamp’ THEN attlen
WHEN typname= ‘bpchar’ THEN a.atttypmod - 4
WHEN typname= ‘varchar’ THEN a.atttypmod - 4
WHEN typname= ‘numeric’ THEN (a.atttypmod - 4 ) / 65536
WHEN typname= ‘decimal’ THEN (a.atttypmod - 4 ) / 65536
ELSE NULL
END AS length,
CASE typname
WHEN ‘numeric’ THEN (a.atttypmod - 4 ) % 65536
WHEN ‘decimal’ THEN (a.atttypmod - 4 ) % 65536
ELSE NULL
END AS precision,
attlen, atttypmod, attnotnull, atttypid, attnum,attstorage
from pg_class c, pg_attribute a, pg_type t
where c.oid = a.attrelid and a.atttypid = t.oid
and relfilenode = attrelid and attnum > 0
and relname not like ‘pg_%’ order by relname, attnum;


Gruß
Hans