Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: rename columns #2478

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

SQL: rename columns #2478

monetdb-team opened this issue Nov 30, 2020 · 0 comments

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2009-02-03 08:00:33 +0100
From: @mlkersten
To: SQL devs <>
Version: -- development
CC: duc, @eyalroz, irares, @PedroTadim, @drstmane

Last updated: 2019-04-30 12:36:02 +0200

Comment 13745

Date: 2009-02-03 20:00:33 +0100
From: @mlkersten

RENAME COLUMN through SQL

Comment 13746

Date: 2009-04-28 13:33:43 +0200
From: @grobian

ALTER TABLE xxx RENAME [ COLUMN ] yyy TO zzz

Comment 13747

Date: 2009-12-04 11:33:54 +0100
From: @mlkersten

seems long hanging fruit.

Comment 13748

Date: 2010-05-04 09:32:09 +0200
From: Pseudo user for Sourceforge import <>

This bug was previously known as tracker item 2561693 at http://sourceforge.net/support/tracker.php?aid=2561693

The original assignee of this bug does not have
an account here. Reassigning to the default assignee
for the component, bugs-sql@monetdb.org.
Previous assignee was nobody@users.sourceforge.net.

Comment 15445

Date: 2011-01-31 14:26:48 +0100
From: @grobian

Created attachment 50
partial rename column patch

This patch contains the work done so far, it actually breaks on the gdk logger, where I cannot do the rename thing.

Attached file: rename-column.patch (text/plain, 8163 bytes)
Description: partial rename column patch

Comment 17071

Date: 2012-03-15 08:00:29 +0100
From: irares

Hello guys,

I have made yesterday the second serious attempt to move our application from Postgres to Monet. I have met two show-stopper issues which put an end to this:

  1. Lack of RENAME TABLE and RENAME COLUMN functionality during the run of our SQL migration scripts. This is serious. For any moderately complex database schema, dropping and recreating tables just to change the name of a column is hard work.
  2. Extremely slow INSERT speed through JDBC (200 rows / second). Postgres does 6000 rows / sec.

It is nice that Monet is 20 times faster than Postgres for reads (and 30 times slower for writes), but the SQL is just too limited.

Comment 17074

Date: 2012-03-15 09:06:13 +0100
From: @drstmane

This rather looks like a feature request that a bug report to me.

Comment 17075

Date: 2012-03-15 09:09:24 +0100
From: @drstmane

As an alternative to renaming tables or columns, using views and handling name mappings in the application could be considered.

Comment 17076

Date: 2012-03-15 13:11:39 +0100
From: irares

(In reply to comment 7)

As an alternative to renaming tables or columns, using views and handling name
mappings in the application could be considered.

This enhancement request was first filled Feb 2009, 3 years and 1 month ago. Wouldn't you say it is more effective that you add a small feature implemented by most common databases, such as Postgres, MySQL, MSSQL, etc, rather than force your users to use difficult and kludgy workarounds? Renaming columns and tables are basic operations, not rocket science.

Comment 17077

Date: 2012-03-15 13:14:32 +0100
From: @grobian

Problem is that even though it seems easy to do, in fact it is not, since at a critical level columns cannot be renamed. The partial patch basically went that way and it won't work. There might be more luck in an approach that drops the column, but sneakily keeps the data around, then creates a new column, and sneakily attaches the saved data again.

Comment 24616

Date: 2016-10-24 23:16:07 +0200
From: @eyalroz

I am just now sorely missing this feature. Scenario: You've loaded a very large amount of data into a DB table, and the original files are gone. Do you really have to recreate the entire table just for a column rename? Surely that can't be right.

By the way...

  • What was missing/unacceptable in Fabian's approach? He made it seem kind of easy, essentially just updating the columns table.
  • Can this be done "manually", by a humanly-feasible manipulating the BBP data while the DBMS is stopped? That could be a kind of a workaround.

Comment 26672

Date: 2018-11-07 11:56:29 +0100
From: @PedroTadim

A new SQL statement will be available in the next feature release of MonetDB for renaming columns:

ALTER TABLE [IF EXISTS] [schemaname.]tablename RENAME [COLUMN] oldname TO newname;

We did this by adding a new entry in the GDK logger referencing the name change of a SQL object, thus no moving data occurs.
However if the column as dependencies (i.g. used in a UDF or SQL key), it can't be renamed. This check is enforced because renaming while the column has references can potentially break users SQL scripts.

Comment 26821

Date: 2019-01-21 15:38:15 +0100
From: @sjoerdmullender

This should be in the next feature release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant