Обсуждение: drop table failed to drop associated sequence

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

drop table failed to drop associated sequence

От
Juan Rojas
Дата:

Hi,
I'm running PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96.
I have a problem when I drop a table which contains a serial field. The system drops the table but the associated sequence still remains in the catalog, so if I want to create the table again with the same structure, CREATE TABLE throws an error because the sequence that it's trying to create already exists.

If somebody has the same same problem, or has the solution, please tell me.
Best regards,
Juan

________________________________________
Juan Rojas
mailto: j.rojas@tiba.com

Re: drop table failed to drop associated sequence

От
Henry House
Дата:
On Mon, Jun 03, 2002 at 12:59:27PM -0300, Juan Rojas wrote:
> Hi,
> I'm running PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96.
> I have a problem when I drop a table which contains a serial field. The
> system drops the table but the associated sequence still remains in the
> catalog, so if I want to create the table again with the same structure,
> CREATE TABLE throws an error because the sequence that it's trying to create
> already exists.

That's easy enough: just run a 'DROP SEQUENCE <sequence_name>' to remove the
sequence before re-creating the table. You may discover the name of the
sequence using '\ds' in psql.

--
Henry House
The attached file is a digital signature. See <http://romana.hajhouse.org/pgp>
for information.  My OpenPGP key: <http://romana.hajhouse.org/hajhouse.asc>.

Вложения