Reverting from subtables to no subtables.

Поиск
Список
Период
Сортировка
Искать

Reverting from subtables to no subtables.

От:
Gan Uesli Starling <alias@starling.us>
Дата:
I have a table which has sub-tables. I'd like to lose the
sub-tables but keep any sub-table rows which are common to
the parent table...including their primary key which is also
common to the main table.

If I DROP the subtable, will I lose all its rows? Or only
the columns not common to the parent table?

How best should I do this?

TIA,

Gan Starling
Kalamazoo MI

Re: Reverting from subtables to no subtables.

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Gan Uesli Starling  writes:
> If I DROP the subtable, will I lose all its rows?

Yes.

> How best should I do this?

Something like
	INSERT INTO parent SELECT appropriate-columns FROM ONLY child;

			regards, tom lane
FAQ