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

On 10/01/06 17:20, Wolfgang Qual wrote:

Hi everybody,
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...
An alternative could be have a command v.db.dropcol that would create a
temp table as a replica of the table in question, sans the column in
question. Not how ever that this can take a long time on a large table
(with many rows). This command could check for the driver type, and if
it sqlite of dbf then it would use the above tricks, and if it is odbc,
pg or mysql, then the column would just be dropped.

--W

--

<:3 )---- Wolf Bergenheim ----( 8:>

On wto, 2006-01-10 at 22:27 +0200, Wolf Bergenheim wrote:

On 10/01/06 17:20, Wolfgang Qual wrote:
> Hi everybody,
> 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 :).

Maciek

--------------------
Szukasz do¶wiadczonej firmy poligraficznej? Zale¿y Ci na terminowo¶ci i atrakcyjnych cenach?
Zapraszamy do nas!
http://www.foldruk.pl/

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@gclements.plus.com>