Bug report #8576

PostGIS literal special character not escaped

Added by Vincent Picavet about 11 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:master 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 #:17319

Description

When commiting a change to a PostGIS data source, for a text field, the "\\" special character is not escaped when transmitted to PostGIS. It is therefore interpreted as a special character and leads to wrong data or SQL error.

The case is particularly problematic with path stored in text fields.

Typical use case on a windows platform :
  • Setup a PostGIS table with a text or varchar field
  • Open this table as a QGIS Layer
  • Declare the text field as a filename path in QGIS Field types (so you can browse for file)
  • Try to add/modify a feature, set a file path by browsing in subdirectories
  • Commit, and see PostgreSQL error on escape character

Solution :
Every "\\" character should be doubled as "\\\\" when passed to PostGIS.

History

#1 Updated by Jürgen Fischer over 8 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

fixed in 7829e7a

Also available in: Atom PDF