Bug report #13856
DB Manager: SET DEFAULT syntax wrong
Status: | Closed | ||
---|---|---|---|
Priority: | Low | ||
Assignee: | - | ||
Category: | DB Manager | ||
Affected QGIS version: | 3.0.0 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 21879 |
Description
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.
Associated revisions
db_manager: add tooltip to default value field when editing table field properties (fixes #13856)
History
#1 Updated by Sebastian Dietrich about 9 years ago
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.#2 Updated by Paolo Cavallini about 9 years ago
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.
#3 Updated by Sebastian Dietrich about 9 years ago
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.
#4 Updated by Paolo Cavallini almost 9 years ago
- Subject changed from DBM manager: SET DEFAULT syntax wrong to DB Manager: SET DEFAULT syntax wrong
#5 Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No
- Regression? set to No
#6 Updated by Paolo Cavallini over 6 years ago
- Priority changed from Normal to Low
- Affected QGIS version changed from 2.8.3 to 3.0.0
- Description updated (diff)
Unchanged in QGIS 3.
#7 Updated by Jürgen Fischer over 6 years ago
- % Done changed from 0 to 100
- Status changed from Open to Closed
Applied in changeset qgis|333f2c3af989eec053a4b6a8e47cad3483a7a390.
#8 Updated by Giovanni Manghi over 6 years ago
- Resolution set to fixed/implemented