Bug report #12268

Oracle : attributes right padded with white characters.

Added by Pierre M over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/Oracle
Affected QGIS version:2.4.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:20453

Description

Aloha,

I loaded geospatial view from Oracle (11g) in QGis 2.4.
When I query on attributes, string like attributes are all right padded with white space character (in the follow exemple, TYPE_LIB and AFF_LIB). My view seems correct when I query with sql on it in sqlplus.

Here the sql I used to create the view :

CREATE OR REPLACE FORCE VIEW "QGIS"."EXPORT_PA_LIBEL"
(
"GID",
"GEOMETRY",
"INSEE_CO",
"RIVOLI_V",
"LIBELLE",
"TEXTE_L",
"TEXTE_L_X",
"TEXTE_L_Y",
"TEXTE_L_O",
"TYPE_LIB",
"AFF_LIB"
)
AS
SELECT GID,
GEOMETRY,
CAST (INSEE_CO AS CHAR (5)),
CAST (RIVOLI_V AS CHAR (4)),
CAST (LIBELLE AS VARCHAR (200)),
CAST (TEXTE_L AS VARCHAR (200)),
CAST (TEXTE_L_X AS VARCHAR (50)),
CAST (TEXTE_L_Y AS VARCHAR (50)),
CAST (TEXTE_L_O AS VARCHAR (50)),
CAST (TYPE_LIB AS CHAR (50)),
CAST (AFF_LIB AS CHAR (50))
FROM PA_LIBEL
WITH READ ONLY;

Here a screenshot of attributes def in QGis.

Is this a known problem ? Am I missing something ? It's pretty annoying when I intend to put etiquettes on features.

Thanks in advance

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Affected QGIS version changed from 2.8.0 to 2.4.0
  • Status changed from Open to Feedback
  • Category changed from Attribute table to Data Provider/Oracle

Hi, could you give qgis 2.8/master a try and see if it still happen? thanks.

#2 Updated by Jürgen Fischer over 5 years ago

Giovanni Manghi wrote:

Hi, could you give qgis 2.8/master a try and see if it still happen? thanks.

The difference between CHAR and VARCHAR is that the former is padded to the given length and the latter isn't. See Overview of Character Datatypes

#3 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to invalid
  • Status changed from Feedback to Closed

Also available in: Atom PDF