---
name: "altertbl"
section: "7l"
platform: "linux"
package: "postgres95"
version: "1.01-1"
release: "Debian 1.2 (Rex)"
platforms: ["linux"]
url: "https://new.carta.tech/altertbl"
---

# altertbl(7l)

add attributes to a class

## NAME

alter table — add attributes to a class

## SYNOPSIS

**alter table** classname \[\*\]\
 	**add column** attname type

## DESCRIPTION

The **alter table** command causes a new attribute to be added to an existing class, *classname*. The new attributes and their types are specified in the same style and with the the same restrictions as in *create*table*(commands).*

In order to add an attribute to each class in an entire inheritance hierarchy, use the *classname* of the superclass and append a “\*”.  (By default, the attribute will not be added to any of the subclasses.)  This should **always** be done when adding an attribute to a superclass.  If it is not, queries on the inheritance hierarchy such as select \* from super\* s will not work because the subclasses will be missing an attribute found in the superclass.

For efficiency reasons, default values for added attributes are not placed in existing instances of a class.  That is, existing instances will have NULL values in the new attributes.  If non-NULL values are desired, a subsequent *update*(commands) query should be run.

You must own the class in order to change its schema.

## EXAMPLE

\-- -- add the date of hire to the emp class --  alter table emp add column hiredate abstime -- -- add a health-care number to all persons -- (including employees, students, ...) -- alter table person \* add column health\_care\_id int4

## SEE ALSO

create table (commands), update (commands).
