Thread: When the locially dropped column is also physically dropped

When the locially dropped column is also physically dropped

From
"rupesh bajaj"
Date:
Hi,
I have dropped a column (say column name is 'A') from the relation R. By setting the attisdropped as true in the pg_catalog.pg_attribute table. But the column is dropped locially not the physically. Can you please tell me when this column will be physically also dropped. Is this column is automatically physically dropped? or I have to run some command to dropped it physically.

Thanks,
Rupesh Bajaj

Re: When the locially dropped column is also physically dropped

From
Ron Johnson
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/27/07 07:01, rupesh bajaj wrote:
> Hi,
> I have dropped a column (say column name is 'A') from the relation R. By
> setting the attisdropped as true in the pg_catalog.pg_attribute table. But
> the column is dropped locially not the physically. Can you please tell me
> when this column will be physically also dropped. Is this column is
> automatically physically dropped? or I have to run some command to dropped
> it physically.

Why didn't you drop the column the proper way?

- --
Ron Johnson, Jr.
Jefferson LA  USA

Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGNiLVS9HxQb37XmcRAs/rAJ9KkXKlagXCe+RWnNd2824gZ0MTdQCgwHRy
uA2IsmiFw7WjrexvEHeY7w8=
=pqnT
-----END PGP SIGNATURE-----

Re: When the locially dropped column is also physically dropped

From
Chris Browne
Date:
rupesh.bajaj@gmail.com ("rupesh bajaj") writes:
> Hi, I have dropped a column (say column name is 'A') from the
> relation R. By setting the attisdropped as true in the
> pg_catalog.pg_attribute table. But the column is dropped locially
> not the physically. Can you please tell me when this column will be
> physically also dropped. Is this column is automatically physically
> dropped? or I have to run some command to dropped it physically.

Ron's comment is well-suggested[1], but a bit of a red herring, as the
column will *NEVER* be "physically dropped." [2]

What will happen is that new tuples will not have the column, but old
tuples will continue to have the (invisible) column for as long as
they "live" in the database.

Footnotes:

[1] Ron Johnson, Jr suggested "Why didn't you drop the column the
proper way?"

[2]  When a column is dropped via ALTER TABLE DROP COLUMN, the effect
in fact is much the same as what you did; the attribute is marked as
dropped.
--
let name="cbbrowne" and tld="linuxdatabases.info" in name ^ "@" ^ tld;;
http://linuxdatabases.info/info/wp.html
"MICROS~1: The People  who Brought the Y2K Bug  into Software Titling"
-- cbbrowne@hex.net

Re: When the locially dropped column is also physically dropped

From
Tom Lane
Date:
Chris Browne <cbbrowne@acm.org> writes:
> Ron's comment is well-suggested[1], but a bit of a red herring, as the
> column will *NEVER* be "physically dropped." [2]

Check.

> What will happen is that new tuples will not have the column, but old
> tuples will continue to have the (invisible) column for as long as
> they "live" in the database.

Actually, new tuples still have the column, it's just always NULL
(and hence takes no space except for a bit in the nulls-bitmap).

            regards, tom lane