Subject RE: [IBDI] Adding a NOT NULL column to a table
Author Joseph Wecker
>
> Agree. I do incremental upgrade in my apps, executing scripts to
> update all
> changed metadata and/or data in the working database, so this
> area is quite
> known to me. I was simply wondering about accordance of the described
> functionality to the SQL standard.
>
> Cheers,
> Dmitry
>


I've not seen it ever specified in the standard, though I could be missing
something.
Here's where I'd expect it to be (below), though I looked in other places.
(Although I agree the current implementation is the ideal).

-Joseph


==========================================
X3H2-92-154/DBL CBR-002
11.11 <add column definition>


11.11 <add column definition>

Function

Add a column to a table.

Format

<add column definition> ::=
ADD [ COLUMN ] <column definition>


Syntax Rules

None.

Access Rules


None.

General Rules

1) The column defined by the <column definition> is added to T.

2) Let C be the column added to T. Every value in C is the default
value for C.

Note: The default value of a column is defined in Subclause
11.5,
"<default clause>".

Note: The addition of a column to a table has no effect on any
existing <query expression> included in a view descriptor or
<search condition> included in constraint descriptor because
any implicit <column reference>s in these clauses are replaced
by explicit <column reference>s when the clause is originally
evaluated. See the Syntax Rules of Subclause 7.10, "<query ex-
pression>".

3) For every table privilege descriptor that specifies T and a
privilege of SELECT, UPDATE, INSERT or REFERENCES, a new col-
umn privilege descriptor is created that specifies T, the same
action, grantor, and grantee, and the same grantability, and
specifies the <column name> of the <column definition>.

4) In all other respects, the specification of a <column defi-
nition> in an <alter table statement> has the same effect as
specification of the <column definition> in the <table defi-
nition> for T would have had. In particular, the degree of T
is increased by 1 and the ordinal position of that column is
equal to the new degree of T as specified in the General Rules
of Subclause 11.4, "<column definition>".


284 Database Language SQL







X3H2-92-154/DBL CBR-002
11.11 <add column definition>


Leveling Rules

1) The following restrictions apply for Intermediate SQL:

None.

2) The following restrictions apply for Entry SQL in addition to
any Intermediate SQL restrictions:

a) Conforming Entry SQL language shall not contain an <add col-
umn definition


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