v.db.connect: accept layer number/name without parser warning#6997
Open
Abhi-d-gr8 wants to merge 1 commit intoOSGeo:mainfrom
Open
v.db.connect: accept layer number/name without parser warning#6997Abhi-d-gr8 wants to merge 1 commit intoOSGeo:mainfrom
Abhi-d-gr8 wants to merge 1 commit intoOSGeo:mainfrom
Conversation
wenzeslaus
requested changes
Feb 6, 2026
Member
wenzeslaus
left a comment
There was a problem hiding this comment.
I need to see more background discussion here to be confident enough to merge this. Tests for different use cases may help to facilitate that.
Comment on lines
-86
to
+89
| field_opt->description = _("Format: layer number[/layer name]"); | ||
| field_opt->gisprompt = "new,layer,layer"; | ||
| field_opt->description = | ||
| _("Layer number or name (format: layer number[/layer name])"); | ||
| /* no gisprompt override: allow layer_number/layer_name without filename | ||
| * validation */ |
Member
There was a problem hiding this comment.
I don't know why new is here in the first place.
Comment on lines
+121
to
+122
| self.assertNotIn("Illegal filename", m.outputs.stderr) | ||
| self.assertNotIn("Character </> not allowed", m.outputs.stderr) |
Member
There was a problem hiding this comment.
Good, but not robust when case or wording changes (likely to happen if also the parameter handling changes).
| @@ -113,6 +114,13 @@ def test_columns_csv(self): | |||
| ).splitlines() | |||
| self.assertEqual(actual, expected) | |||
|
|
|||
| def test_layer_number_name_syntax_no_warning(self): | |||
| """layer=number/name should not trigger filename validation warnings""" | |||
| m = SimpleModule("v.db.connect", map="bridges", layer="1/bridges", flags="c") | |||
Member
There was a problem hiding this comment.
The doc and general expectation is layer or number, so all these need test. Number only should be easy to test. I'm not clear about how name is actually supported here, while at same time, there is a lot of ways this tool can be used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6100
v.db.connect advertises and prints the layer number[/layer name] syntax, but using layer=1/name triggered a parser warning:
Illegal filename <1/name>. Character </> not allowed. This was caused by filename validation being enabled for the layer option via field_opt->gisprompt. This PR removes that override so the documented number/name syntax works without warnings, and adds a regression test to ensure no warning is emitted.
@wenzeslaus