Patch for BUG #2073: Can't drop sequence when created via SERIAL column

Started by Dhanaraj Mabout 20 years ago6 messagespatches
Jump to latest
#1Dhanaraj M
Dhanaraj.M@Sun.COM

Hi

I send the appropriate patch for bug #2073. This fix disallows to change the default sequence.
I ran the regression test and passed. The bug details are given below.
I am awaiting to answer for any further clarifications.

===================================================================

Bug reference: 2073
Logged by: Aaron Dummer
Email address: aaron ( at ) dummer ( dot ) info
PostgreSQL version: 8.0.3
Operating system: Debian Linux
Description: Can't drop sequence when created via SERIAL column
Details:

If I create a table named foo with a column named bar, column type SERIAL,
it auto-generates a sequence named foo_bar_seq. Now if I manually create a
new sequence called custom_seq, and change the default value of foo.bar to
reference the new sequence, I still can't delete the old sequence
(foo_bar_seq).

In other words, from a user's point of view, the foo table is no longer
dependent on the foo_bar_seq, yet the system still sees it as dependent.

I brought this topic up on the #postgresql IRC channel and the behavior was
confirmed by AndrewSN, scampbell_, and mastermind.

Right. We have this TODO item:

* %Disallow changing default expression of a SERIAL column?

which would prevent you from changing the default expression for a
SERIAL column. So the answer is, don't do that, and in the future, we
might prevent it.

--
Bruce Momjian

==================================================================

Attachments:

2073_defaultSeq.patchtext/x-patch; name=2073_defaultSeq.patchDownload+144-0
#2Bruce Momjian
bruce@momjian.us
In reply to: Dhanaraj M (#1)
Re: Patch for BUG #2073: Can't drop sequence when created

Patch applied. Thanks.

---------------------------------------------------------------------------

Dhanaraj M wrote:

Hi

I send the appropriate patch for bug #2073. This fix disallows to change the default sequence.
I ran the regression test and passed. The bug details are given below.
I am awaiting to answer for any further clarifications.

===================================================================

Bug reference: 2073
Logged by: Aaron Dummer
Email address: aaron ( at ) dummer ( dot ) info
PostgreSQL version: 8.0.3
Operating system: Debian Linux
Description: Can't drop sequence when created via SERIAL column
Details:

If I create a table named foo with a column named bar, column type SERIAL,
it auto-generates a sequence named foo_bar_seq. Now if I manually create a
new sequence called custom_seq, and change the default value of foo.bar to
reference the new sequence, I still can't delete the old sequence
(foo_bar_seq).

In other words, from a user's point of view, the foo table is no longer
dependent on the foo_bar_seq, yet the system still sees it as dependent.

I brought this topic up on the #postgresql IRC channel and the behavior was
confirmed by AndrewSN, scampbell_, and mastermind.

Right. We have this TODO item:

* %Disallow changing default expression of a SERIAL column?

which would prevent you from changing the default expression for a
SERIAL column. So the answer is, don't do that, and in the future, we
might prevent it.

--
Bruce Momjian

==================================================================

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: Patch for BUG #2073: Can't drop sequence when created

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Patch applied. Thanks.

Has this been reviewed at all? I thought we were still discussing what
the behavior should be, let alone whether the patch is correct.

regards, tom lane

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tom Lane (#3)
Re: Patch for BUG #2073: Can't drop sequence when created

I wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Patch applied. Thanks.

Has this been reviewed at all? I thought we were still discussing what
the behavior should be, let alone whether the patch is correct.

Actually, now that I look at it, this patch is definitely *not* correct,
as it does not implement any of the behaviors suggested as reasonable;
and the discussion is still ongoing in any case.

Please revert.

regards, tom lane

#5Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#4)
Re: Patch for BUG #2073: Can't drop sequence when created

Tom Lane wrote:

I wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Patch applied. Thanks.

Has this been reviewed at all? I thought we were still discussing what
the behavior should be, let alone whether the patch is correct.

Actually, now that I look at it, this patch is definitely *not* correct,
as it does not implement any of the behaviors suggested as reasonable;
and the discussion is still ongoing in any case.

Please revert.

Done.

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#6Bruce Momjian
bruce@momjian.us
In reply to: Dhanaraj M (#1)
Re: Patch for BUG #2073: Can't drop sequence when created

Patch applied. Thanks.

---------------------------------------------------------------------------

Dhanaraj M wrote:

Hi

I send the appropriate patch for bug #2073. This fix disallows to change the default sequence.
I ran the regression test and passed. The bug details are given below.
I am awaiting to answer for any further clarifications.

===================================================================

Bug reference: 2073
Logged by: Aaron Dummer
Email address: aaron ( at ) dummer ( dot ) info
PostgreSQL version: 8.0.3
Operating system: Debian Linux
Description: Can't drop sequence when created via SERIAL column
Details:

If I create a table named foo with a column named bar, column type SERIAL,
it auto-generates a sequence named foo_bar_seq. Now if I manually create a
new sequence called custom_seq, and change the default value of foo.bar to
reference the new sequence, I still can't delete the old sequence
(foo_bar_seq).

In other words, from a user's point of view, the foo table is no longer
dependent on the foo_bar_seq, yet the system still sees it as dependent.

I brought this topic up on the #postgresql IRC channel and the behavior was
confirmed by AndrewSN, scampbell_, and mastermind.

Right. We have this TODO item:

* %Disallow changing default expression of a SERIAL column?

which would prevent you from changing the default expression for a
SERIAL column. So the answer is, don't do that, and in the future, we
might prevent it.

--
Bruce Momjian

==================================================================

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +