[GRASS5] Re: [GRASSLIST:9778] Re: drop column?

Glynn Clements glynn at gclements.plus.com
Tue Jan 10 23:11:53 EST 2006


Maciek Sieczka wrote:

> > > I just read that SQLITE also does not support "ALTER TABLE table DROP
> > > COLUMN". ("SQLite's version of the ALTER TABLE command allows the user to
> > > rename or add a new column to an existing table. It is not possible to
> > > remove a column from a table." [1]
> > > How to deal with this issue?
> > 
> > I guess we just have to live with it ):. The DBF supports even less...
> 
> The lack of "drop column" in sqlite has been discussed a bit here
> http://www.mail-archive.com/sqlite-users@sqlite.org/msg03110.html
> There is a notion of planning to implement "drop column" in sqlite. But
> this was 2004... Let's try to convince sqlite devs it is still important
> for users. I have just started doing so :).

Modifying table structure is quite tricky to implement if you have
multi-field primary keys, constraints which reference the column,
foreign key constraints in another table etc.

The SQL standard specifies CASCADE and RESTRICT options for the
various DROP commands. When the CASCADE option is given, any
dependencies (constraints which reference the object being dropped)
are themselves dropped, causing their dependencies to be dropped, and
so on. If you use the RESTRICT option (which is usually the default),
attempting to drop an object which has dependencies results in an
error.

If you drop a column by copying the table's contents, you will
probably end up with an extreme version of CASCADE, i.e. dropping all
of the constraints regardless of whether or not they actually depend
upon the dropped column.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list