Start a new topic

Order of columns in alter table

[This topic is migrated from our old forums. The original author name has been removed]

Would love to have the ability to alter the order of columns in alter table. Useful when rapidly prototyping web applications in Rails-like frameworks.

[This reply is migrated from our old forums.]

Re: Order of columns in alter table
Hi Evan, Most databases prevent you from modifying the physical order of columns, since the physical order of rows and columns is considered insignificant in the relational database model; the presentation order is instead specified in the SELECT statement. As far as I know, the only exception is MySQL. In general, the Alter Table dialog exposes only the modifications that can be done using the ALTER TABLE statement for the database. Since column reordering is supported by so few databases, we have so far not exposed it for any database. If there's more demand for this, we may add it in the future. Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: Order of columns in alter table
There are a few databases that do provide this feature. I understand that the select gives the order, however, when people look at a model, it has to read in a natural way. If you look at a table and you see a first name field, you would hope that last name would follow behind it or behind the middle name; it makes a model faster to read and understand. As to the databases that support it. Perhaps dbvisualizer doesn't support those databases, but here are the list: Oracle via the DBMS_REDEFINITION - http://psoug.org/reference/dbms_redefinition.html mysql via the alter table - firebird via the alter table - http://www.ibphoenix.com/main.nfs?a=ibphoenix&s=1154534295:6&page=ibp_60_altercol_fs microsoft sql - They provide this in their enterprise manager, however, what I suspect what they do is create a new table, copy all the data over, under the new order, and then rename the table. Which kind of solves the problem for other databases that doesn't do it. On the development boards for: postgres
[This reply is migrated from our old forums. The original author name has been removed]

Re: Order of columns in alter table
Just to provide a contrarian view, I am not sure I see the issue here, in those databases that support this SQL commander can be used to enter the appropriate statements. This is an edge case which is rarely needed by most people. After all, as pointed out above related columns would have been placed adjacent to each other already. If you know what you are doing then you can enter the SQL by hand, otherwise IMHO you should step away from the mouse and leave well alone. To provide GUI support would require code tailored to each individual database making DbVisualiser more complex (UNDO? yes people would want that too) and more difficult to test and maintain, potentially compromising its value for the features it is most frequently used for. Count this as a no vote against GUI support for alter table in DbVisualiser, it is unnecessary mission creep. However, the world lacks a decent reasonably priced database refactoring toolkit, if dbvis wanted to branch out and introduce a second product (which might have code in common with DbVisualiser) then that would IMHO be a very interesting thing
[This reply is migrated from our old forums. The original author name has been removed]

Re: Order of columns in alter table
Interesting argument, however I think that my original request still makes sense: As a feature for those using DBVis for rapid prototyping and agile development, column ordering would be of value. Edited by: Evan Owens on Jan 16, 2011 5:28 PM