<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>PostGIS and Map 3D 2010 autoincrement problems</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">Hi List,</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">I have tested AutoCAD Map 3D 2010, FDO PostGIS 3.4, PostGIS 8.2.13</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">with sample data &quot;towns&quot; from</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"></SPAN><A HREF="http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_tut01"><SPAN LANG="de-at"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_tut01</FONT></U></SPAN></A><SPAN LANG="de-at"></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">In the testcases the error messages are caused by the constraints (geometrytype, serial Primary Key) on the table &quot;towns&quot; in PostGIS.</FONT></SPAN></P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">These constraints will be created by default by an import of data with the tool &quot;shp2pgsql&quot;.</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">There is no way to set the splitting rules for &quot;gid&quot; in AutoCAD Map to NULL because there is a &quot;NOT NULL&quot; constraint by the serial primary key property.</FONT></SPAN></P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">For all it is important that before importing the shp-files in PostGIS they have to be saved with codeset utf-8 instead of default win1252.</FONT></SPAN></P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">With QGIS this is no problem.</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">############&nbsp; Case 1&nbsp; #######################</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">if the table &quot;towns&quot; is created like below:</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">CREATE TABLE &quot;towns&quot; (gid serial PRIMARY KEY,........);</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">SELECT AddGeometryColumn('','towns','the_geom','26986','MULTIPOLYGON',2);</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">INSERT INTO &quot;towns&quot; (&quot;objectid&quot;,&quot;.....</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">I tried to check in 2 Polyons merged with the function &quot;GIS-Object manipulation&quot; &quot;Object merge&quot;</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">i got these message</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">-FdoPostGIS:towns (220), Rev# &lt;-1&gt;</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">-object could not be updatet</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">1=FDO-Command could not be executed.</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">2=The execution of SQL statement failed with PostgreSQL error code: PGRES_FATAL_ERROR, FEHLER: new row for Relation &gt;&gt;towns&lt;&lt; violates Check-Constraint &gt;&gt;enforce_geotype_the_geom&lt;&lt;</FONT></SPAN></P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">some objects could not be stored</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">manipulated row could not be stored.</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">ceck in of a splitted polygon causes also an error message</FONT></SPAN>
</P>
<BR>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">############&nbsp; Case 2&nbsp; #######################</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">if the table &quot;towns&quot; is created like below:</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">CREATE TABLE &quot;towns&quot; (gid serial PRIMARY KEY,........);</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">SELECT AddGeometryColumn('','towns','the_geom','26986','GEOMETRY',2);</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">INSERT INTO &quot;towns&quot; (&quot;objectid&quot;,&quot;....</FONT></SPAN>
</P>
<BR>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">check in of merged objects will work</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">check in fo splittet objects caused an error message</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">- FdoPostGIS:towns_serial[],Rev#&lt;0&gt;</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">- object could not be inserted</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">- 1=FDO-command could not be executed</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">- 2=invalid propertyname</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">some objects could not be stored</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">despite of this error message one part of the polygon which was splittet is stored in the postgis with gid = max(gid) + 1 and one part has an updated geometry (with splitting option &quot;use existing ids&quot;)</FONT></SPAN></P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">in this case manually updating the value of gid is not possible</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">the provider does not evaluate the next possible unique value of gid</FONT></SPAN>
</P>
<BR>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">######## Case 3 #################</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">if the table &quot;towns&quot; is created like below:</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">CREATE TABLE &quot;towns&quot; (gid int4,.....);</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">SELECT AddGeometryColumn('','towns','the_geom','26986','GEOMETRY',2);</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">INSERT INTO &quot;towns&quot; (&quot;objectid&quot;,&quot;..........</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">UPDATE &quot;public&quot;.&quot;towns&quot; set gid = objectid;</FONT></SPAN>

<BR><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">ALTER TABLE &quot;public&quot;.&quot;towns&quot; ADD PRIMARY KEY (gid);</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">check in of merged objects will work</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">check in of splittet polygon</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">if you choosed splitting with option use existing ids you have to update the gid for one part of the splitted polygon manually to a unique value</FONT></SPAN></P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">if you choosed splitting with option new ids you have to update the gid for all checked out polygons manually to a unique value</FONT></SPAN></P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">so before the manipulation you should look for max (gid) by sorting the table</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">For me it would be important, what type of tables in PostGIS have to be created to allow correct gis-object manipulation in AutoCAD Map 3D.</FONT></SPAN></P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">It would be also nice to have a demo data-set in a sample-table to verify the correct installation of the provider.</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">greetings</FONT></SPAN>
</P>

<P><SPAN LANG="de-at"><FONT SIZE=2 FACE="Arial">Karl</FONT></SPAN><SPAN LANG="de"></SPAN>
</P>

</BODY>
</HTML>