#172 Keep attributes on paste into layer with different schema

open
nobody
None
5
2014-07-23
2012-09-13
OJ User
No

Objects can be transferred using copy and paste from one layer to another. Unfortunately OpenJUMP different sets at SHAPE column names with uppercase and lowercase letters: the "Name" column is not the "name" column, thus attributes are not transferred and lost.
This occurs in older versions as well as in the last build 2998
Windows XP Professional, 32bit

Discussion

  • I understand it could be helpful...
    but I don't think it should be done !

    Every identifier in java is case sensitive. I would not consider case sensitivity as a bug.
    FeatureSchemas may have 2 different attributes called "NAME" and "name".
    Imagine your target schema has a single attribute "NAME" and your source schema has two different attributes "NAME" and "name".
    Copying a feature from source to target may copy the value of the attribute NAME (exact matching), then overwrite it with the attribute name (case insensitive matching). This later situation would really be a bug !

    Let's keep things simple : java and OpenJUMP are case sensitive. There are pros and cons, but behaviour is predictable. Adding case insensitivity here and there is possible but would make things unpredictable and more difficult to maintain. At least that is my feeling.

    Michaël

     
  • Jukka Rahkonen
    Jukka Rahkonen
    2012-09-14

    OpenJUMP does not seem to be totally case sensitive. Try to create a new layer with OJ and create fields "name" and "NAME" - it is not possible because OJ says that "NAME" exists.
    When is comes to original question, for me it is not a bug. However, I know that some GIS programs are doing selects from database using cast to uppercase (or perhaps to lowercase). That will make trouble if table really had from some odd reason both "name" and "NAME" fields. I believe that cast is made for helping lazy folks like me to write SQL queries agains mixed case table and field names.
    Anyway, OJ is used for editing and if "Name" attribute is copied as "NAME" it will not be possible to save it later back to PostGIS.

     
  • ede
    ede
    2012-09-14

    • labels: 746641 -->
    • milestone: 428052 -->
    • summary: Copy and paste objects with attributes --> Keep attributes on paste into layer with different schema
     
  • ede
    ede
    2012-09-14

    right that contradicts the possibility of 'columns with identical names except of case'.

    Michael: shouldn't that be a warning instead of an error? especially as you say imported data schema can hold e.g. 'name' and 'Name' at the same time?

    Bernd: a workaround might be renaming the column in the schema of either the source or the target layer prior to copying features.

    Most elegant solution would be an intelligent paste that detects that columns cannot be transferred and asks you to ignore/reassign columns.

    ..ede

    PS: I changed the summary to be a bit more precise and move this to feature requests.

     
  • I agree this can be improved with warnings or intelligent code detecting ambiguous cases.
    Hopefully, someone will volonteer to take care of this.