Opened 14 years ago
Closed 14 years ago
#2819 closed bug (fixed)
Copied record field mismatch from shapefile to postgis
Reported by: | bonzai | Owned by: | jef |
---|---|---|---|
Priority: | minor: annoyance | Milestone: | Version 1.5.0 |
Component: | Data Provider | Version: | 1.4.0 |
Keywords: | Cc: | ||
Must Fix for Release: | No | Platform: | Gentoo |
Platform Version: | Awaiting user input: | yes |
Description
During feature copy (using Ctrl+C Ctrl+V) between shapefile and postgis layers field's values are someway shifted.
Original SHAPEFILE feature attributes
app_id: NULL
su_id: NULL
su: 36 <-------- RIGHT
phase: NULL
date: NULL
Copied PostGIS feature attributes
app_id: NULL
su_id: 36 <--------- WRONG
su: NULL
phase: NULL
date: NULL
Change History (7)
follow-up: 2 comment:1 by , 14 years ago
Awaiting user input: | set |
---|
comment:2 by , 14 years ago
Replying to jef:
The field values are assigned in order not by name. Does the attribute order in your postgis table match the order of fields in the shapefile's dbf?
Looking in layers' properties attribute tab I've found this:
SHAPEFILE
-|id|name
1|0 |app_id
2|1 |su_id
3|2 |su <-------
4|3 |phase
5|4 |date
POSTGIS
-|id|name
1|0 |app_id
2|2 |su_id
3|3 |su <-------
4|4 |phase
5|5 |date
So it seems thats records have the same order but different ids. A further information that could you help: the shapefile is the result of 'Export as shapefile' QGIS command.
follow-ups: 4 5 comment:3 by , 14 years ago
Might the geometry column in postgis not be the last column?
comment:4 by , 14 years ago
Replying to jef:
Might the geometry column in postgis not be the last column?
Actually it's not a table but a view with insert,update,delete rules:
CREATE OR REPLACE VIEW dataschemaname.w_core_geom_sus AS
SELECT g.app_id, g.geom, s.app_id AS su_id, s.short_def AS su, ph.short_def AS phase, s.date
FROM dataschemaname.core_geom_sus g LEFT JOIN dataschemaname.core_std_sus s ON g.su_id = s.app_id LEFT JOIN dataschemaname.core_voc_phases ph ON s.phase_id = ph.app_id;
As you can see the geometry column is the second one. Should it be the last one? It's not a big issue but I've never heard about this...
follow-up: 6 comment:5 by , 14 years ago
Priority: | major: does not work as expected → minor: annoyance |
---|
Replying to jef:
Might the geometry column in postgis not be the last column?
Reoerdering view's fields putting geometry colums last works for me. But in my opinion it's just a workaround and not a proper solution so I just changed the priority to minor.
Thanks for the quick answer
comment:6 by , 14 years ago
Owner: | changed from | to
---|
Replying to bonzai:
Reoerdering view's fields putting geometry colums last works for me. But in my opinion it's just a workaround and not a proper solution so I just changed the priority to minor.
Sure it is.
The field values are assigned in order not by name. Does the attribute order in your postgis table match the order of fields in the shapefile's dbf?