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 <j.iven@rz.uni-sb.de>)
Список pgsql-hackers
>
> 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 по дате отправления:

Предыдущее
От: Gilmar Ribeiro da Rosa
Дата:
Сообщение: ...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] copy