Обсуждение: PostgresSQL drop table -> drop serial

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

PostgresSQL drop table -> drop serial

От
Jason Hihn
Дата:
/* please forgive me if you've seen this before. I've tried sending this
several times, but I have not seen it show up on the list yet. I was
having some subscribing trouble */

Hello. I was reading through the postgre docs, and saw that it was
listed to 'fix' the non-autodrop of serials. If that is correct, then I'd
like to pursuade you to not do that, or at least be able to disable it.

See, I have a database schema such that 2 (or more) tables use the same
serial. I won't get into what I was smoking when I did that, but it
extremely useful. I am concerned that if auto-dropping was enabled, then
if I ever had to drop a table for whatever reason, that I would lose my
serial in another table. And even if both tables were dropped, I'd still
like to have that serial there incase those tables are brought back.

I know it is the complaint of many MySQL users that serials should be
dropped automatically, but hey, these people are using mysql in the first
place which calls the value of their opinions into question =) Any real DB
person would not mind such a 'quirk' of a DBMS - and I am exploiting that
feature (I don't know which is worse =) . So, if it is to be implemented
please leave it as an easily configurable option.

And please forgive me if this opion has already been rasied. (New to the
list)

Thank you for your time and wonderful DBMS.

PS. The serial is being used between one table and another table which is
a weak entity set of the 'master.' When there is a tuple having a weak
entity id == master id, then that record is considered a special tuple,
and is handled accordingly. I still won't say what I was smoking when I
came up with that though =). (I realize this limits the number of weak
entities+ masters to 2^31, which is fine for me.)






Re: PostgresSQL drop table -> drop serial

От
"Ross J. Reedstrom"
Дата:
On Mon, Aug 14, 2000 at 02:56:05PM -0400, Jason Hihn wrote:
> /* please forgive me if you've seen this before. I've tried sending this
> several times, but I have not seen it show up on the list yet. I was
> having some subscribing trouble */
>
> Hello. I was reading through the postgre docs, and saw that it was
> listed to 'fix' the non-autodrop of serials. If that is correct, then I'd
> like to pursuade you to not do that, or at least be able to disable it.

I'd presume that the fix would involve only auto dropping sequences that
where auto created. In order to get two tables using one sequence, you're
going to have to hand code the DEFAULT for at least one of them, so it's
(almost) no work for you to just do it twice. That has the benefit of
allowing you to use a more descriptive name for this sequence, as well
as being absolutely sure what the sequence name _is_.

In short, don't worry about it: the developer's go to a lot of trouble
to _not_ break backwards compatability, and if they must, make sure
there's a simple upgrade path.

Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005