public inbox for [email protected]
help / color / mirror / Atom feedFrom: Bruce Momjian <[email protected]>
To: robins <[email protected]>
Cc: [email protected]
Subject: Re: Clarify 'dependent objects' for DROP COLUMN
Date: Wed, 13 Mar 2013 18:41:42 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEP4nAzCAOC_vAd0FzE8wD-jnD8_DGGt+BWCRmhhPuHfbHF55g@mail.gmail.com>
References: <CAEP4nAxFw=2pB-oJyWZkwo7hccggoDzooEBmv+umd1R-neyZXg@mail.gmail.com>
<[email protected]>
<CAEP4nAzCAOC_vAd0FzE8wD-jnD8_DGGt+BWCRmhhPuHfbHF55g@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-docs>
On Thu, Mar 14, 2013 at 03:38:42AM +0530, robins wrote:
> Thanks Bruce.
>
> I think by using the word 'constraint' I understand what the documentation
> meant.
>
> Both my queries (samples given below) arose from the fact that although there
> was a 'relation', this is probably not what the documentation was talking
> about.
>
> Q1:
> postgres=# CREATE TABLE serialTest3 (f1 bigint);
> CREATE TABLE
> postgres=# CREATE SEQUENCE seq4 OWNED BY serialTest3.f1;
> CREATE SEQUENCE
> postgres=# DROP SEQUENCE seq4;
> DROP SEQUENCE
> postgres=#
>
>
> Q2:
> postgres=# CREATE TABLE serialTest3 (f1 bigint);
> CREATE TABLE
> postgres=# CREATE SEQUENCE seq4 OWNED BY serialTest3.f1;
> CREATE SEQUENCE
> postgres=# ALTER TABLE serialTest3 DROP COLUMN f1 RESTRICT;
> ALTER TABLE
> postgres=#
>
> I was working on some regression tests and then just wanted to be sure that
> this (Q2 in particular) was perfectly legal, before adding checks for them.
It seems like the OWNED BY only handles auto-drop, rather than sequence
removal restrictions:
The <literal>OWNED BY</literal> option causes the sequence to be
associated with a specific table column, such that if that column
(or its whole table) is dropped, the sequence will be automatically
dropped as well. The specified table must have the same owner and be in
the same schema as the sequence.
<literal>OWNED BY NONE</literal>, the default, specifies that there
is no such association.
Seems it is not the same as actually referencing the sequence in the table.
--
Bruce Momjian <[email protected]> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
--
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
view thread (5+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Clarify 'dependent objects' for DROP COLUMN
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox