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

DB Manager: SET DEFAULT syntax wrong #21879

Closed
qgib opened this issue Nov 19, 2015 · 8 comments
Closed

DB Manager: SET DEFAULT syntax wrong #21879

qgib opened this issue Nov 19, 2015 · 8 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin

Comments

@qgib
Copy link
Contributor

qgib commented Nov 19, 2015

Author Name: Paolo Cavallini (@pcav)
Original Redmine Issue: 13856
Affected QGIS version: 3.0.0
Redmine category:db_manager


When setting the default for a column value, DB Manager fails to quote the value, e.g.

ALTER TABLE "pippo"."comuni" ALTER "nomemin" SET DEFAULT test123

instead of

ALTER TABLE "pippo"."comuni" ALTER "nomemin" SET DEFAULT 'test123'

therefore the command fails.

@qgib
Copy link
Contributor Author

qgib commented Nov 19, 2015

Author Name: Sebastian Dietrich (Sebastian Dietrich)


I would say this is intended behaviour. You are not entering a value, but an expression.

ALTER TABLE "table" ALTER "column" SET DEFAULT current_user

works, because @current_user@ is a (PostgreSQL-)function and therefore a valid expression.

@qgib
Copy link
Contributor Author

qgib commented Nov 19, 2015

Author Name: Paolo Cavallini (@pcav)


If the user is required to add '', this should be made clear, it is not obvious. Perhaps adding a note to the error message would suffice.

@qgib
Copy link
Contributor Author

qgib commented Nov 21, 2015

Author Name: Sebastian Dietrich (Sebastian Dietrich)


Adding quotes always works, but is not always the correct solution. E.g. if I enter @currentuser@ the solution would be to correct the function name, not to add quotes. So the errormessage could be misleading.

Would a hint to the user when entering the default (e.g. a tooltip or a label) also suffice?
Something like:
Note: This is an expression, string literals must be properly quoted.

@qgib
Copy link
Contributor Author

qgib commented Dec 19, 2015

Author Name: Paolo Cavallini (@pcav)


  • subject was changed from DBM manager: SET DEFAULT syntax wrong to DB Manager: SET DEFAULT syntax wrong

@qgib
Copy link
Contributor Author

qgib commented Apr 30, 2017

Author Name: Giovanni Manghi (@gioman)


  • easy_fix was configured as 0
  • regression was configured as 0

@qgib
Copy link
Contributor Author

qgib commented Mar 7, 2018

Author Name: Paolo Cavallini (@pcav)


Unchanged in QGIS 3.


  • priority_id was changed from Normal to Low
  • version was changed from 2.8.3 to 3.0.0
  • description was changed from When setting the default for a column value, DB Manager fils to quote the value, e.g.

ALTER TABLE "pippo"."comuni" ALTER "nomemin" SET DEFAULT test123

instead of

ALTER TABLE "pippo"."comuni" ALTER "nomemin" SET DEFAULT 'test123'

therefore the commnad fails. to When setting the default for a column value, DB Manager fails to quote the value, e.g.

ALTER TABLE "pippo"."comuni" ALTER "nomemin" SET DEFAULT test123

instead of

ALTER TABLE "pippo"."comuni" ALTER "nomemin" SET DEFAULT 'test123'

therefore the command fails.

@qgib
Copy link
Contributor Author

qgib commented Mar 8, 2018

Author Name: Jürgen Fischer (@jef-n)


Applied in changeset 333f2c3.


  • done_ratio was changed from 0 to 100
  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Mar 8, 2018
@qgib
Copy link
Contributor Author

qgib commented Mar 8, 2018

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to fixed/implemented

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin
Projects
None yet
Development

No branches or pull requests

1 participant