On 10/25/07, Steve Crawford <scrawford@xxxxxxxxxxxxxxxxxxxx> wrote: > Alvaro Herrera wrote: > ... > > > > You can use CREATE TABLE LIKE, which copies the definition but does not > > set the inheritance. > > > > Well, sort of. > > Unless I'm using it incorrectly it only copies the basic column > definitions and, as optionally specified, defaults and some of the > constraints. > > Primary key constraints are lost as CREATE TABLE newtable (LIKE > oldtable) does not create any indexes including those necessary for the > primary key. > > I don't know how foreign-key constraints are handled as I haven't used > this form of CREATE TABLE where foreign keys are involved. Neither inheritance nor creating LIKE will inherit primary keys. Foreign keys will not be inherited by either method either. ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings