Bug report #21425

DB Manager rename PostGIS column error

Added by Topi Tjukanov over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:High
Assignee:Alexander Bruy
Category:DB Manager
Affected QGIS version:3.6.0 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29242

Description

With DB Manager in QGIS 3.6 when I try to rename a column through the DB Manager GUI (Table --> Edit table --> Edit column), it seems that DB Manager is also trying to add a comment (I had the comment field empty) but with the old name:

So e.g. I tried to rename column field_2 to long in table foo.bar

Here's the query that it tries to run:
COMMENT ON COLUMN foo.bar.field_2 is ''

This is the error that it throws:
column "field_2" of relation "fool.bar" does not exist

So I guess a fix for this would be not to try to add a comment if the comment field is empty and also make the commented field to be the new one.

Associated revisions

Revision 03abf0e4
Added by Alexander Bruy over 5 years ago

[db_manager] apply comment to the correct column when altering table
column (fix #21425)

Revision dc6780a8
Added by Alexander Bruy over 5 years ago

Merge pull request #10082 from alexbruy/postgis-comment

[db_manager] apply comment to the correct column when altering table column (fix #21425)

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Regression? changed from No to Yes
  • Subject changed from DB Manager rename bug to DB Manager rename column error
  • Priority changed from Normal to High
  • Operating System deleted (Windows 10)

Does not happen in 3.4.5

#2 Updated by Giovanni Manghi over 5 years ago

  • Subject changed from DB Manager rename column error to DB Manager rename PostGIS column error

#3 Updated by Alexander Bruy over 5 years ago

  • Status changed from Open to In Progress
  • Assignee set to Alexander Bruy

#4 Updated by Alexander Bruy over 5 years ago

  • Pull Request or Patch supplied changed from No to Yes

#5 Updated by Alexander Bruy over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF