[GRASS-SVN] r69672 - grass/trunk/vector/v.out.postgis

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 4 00:19:21 PDT 2016


Author: martinl
Date: 2016-10-04 00:19:21 -0700 (Tue, 04 Oct 2016)
New Revision: 69672

Modified:
   grass/trunk/vector/v.out.postgis/main.c
Log:
v.out.postgis doesn't export attribute table (see #2460)

Modified: grass/trunk/vector/v.out.postgis/main.c
===================================================================
--- grass/trunk/vector/v.out.postgis/main.c	2016-10-04 05:01:52 UTC (rev 69671)
+++ grass/trunk/vector/v.out.postgis/main.c	2016-10-04 07:19:21 UTC (rev 69672)
@@ -134,18 +134,19 @@
         G_fatal_error(_("Unable to create PostGIS layer <%s>"),
                       olayer);
     G_add_error_handler(output_handler, &Out);
-    
+
+    /* copy attributes (must be done before checking output type
+       otherwise attributes are not copied) */
+    field = Vect_get_field_number(&In, params.layer->answer);
+    if (!flags.table->answer)
+        Vect_copy_map_dblinks(&In, &Out, TRUE);
+
     /* check output type */
     if (otype > 0) { /* type is not 'auto' */
         if (Vect_write_line(&Out, otype, NULL, NULL) < 0)
             G_fatal_error(_("Feature type %d is not supported"), otype);
     }
 
-    /* copy attributes */
-    field = Vect_get_field_number(&In, params.layer->answer);
-    if (!flags.table->answer)
-        Vect_copy_map_dblinks(&In, &Out, TRUE);
-
     /* copy vector features & create PostGIS table */
     if (Vect_copy_map_lines_field(&In, field, &Out) != 0)
         G_fatal_error(_("Copying features failed"));



More information about the grass-commit mailing list