Re: [HACKERS] DROPping tables with SERIALs
От
jwieck@debis.com (Jan Wieck)
Тема
Re: [HACKERS] DROPping tables with SERIALs
Дата
Msg-id
m0zjQfU-000EBjC@orion.SAPserv.Hamburg.dsh.de
Ответ на
DROPping tables with SERIALs (Jan Iven)
Список
Дерево обсуждения
Re: [HACKERS] DROPping tables with SERIALs Vadim Mikheev <vadim@krs.ru>
Re: [HACKERS] DROPping tables with SERIALs Bruce Momjian <maillist@candle.pha.pa.us>
>
> Hi,
>
> I have run into a problem dropping and re-creating tables with
> type SERIAL:
>
> CREATE TABLE t ( s SERIAL);
> DROP TABLE t;
> CREATE TABLE t ( s SERIAL);
>
> gives
> ERROR: t_s_seq relation already exists
>
> This looks like the implicitly created sequence t_s_seq is not dropped
> together with the table.
>
> I am running a current (?) cvs snapshot from anoncvs@postgresql.org.
>
> Jan
>
>
Yepp. The serial type is implemented as an integer with a
default of nextval('tab_attr_seq') and the sequence itself
created on the fly.
I think we should have an additional oid field in
pg_attribute that holds the oid of the created sequence and
that is examined at drop table time to drop the serials too.
TODO for v6.5 ?
Jan :-)
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #В списке pgsql-hackers по дате отправления