[fdo-users] PostGIS and Map 3D 2010 autoincrement problems
David Anderson
da at donnellandallred.com
Tue Jun 23 17:37:12 EDT 2009
Mike:
I finally figured out a workaround. In a nutshell:
Create TRIGGER and FUNCTION to set NEW.gid to
nextval('some_sequence'::regclass)
TRIGGER should be on BEFORE INSERT event.
Default value of the gid column should be set to 1 (it will be
changed by the TRIGGER).
If you would like more detailed steps, including the SQL statements, let
me know.
Map 3D adds the features appropriately by sending a 1 as the gid. The
data table will still show a 1 until the layer is refreshed.
I don't know if this is an FDO issue or an AutoCAD issue. Any comments
from some more knowledgeable users would be appreciated.
Thanks,
David
-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org
[mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Mike Toews
Sent: Monday, June 22, 2009 5:53 PM
To: FDO Users Mail List
Subject: Re: [fdo-users] PostGIS and Map 3D 2010 autoincrement problems
David,
Yikes. I've been demoing Map3D 2010 for the past few weeks to see if we
want to upgrade from 2008, and I can reproduce the same behavior you
describe in 2010. This behavior is new to me, since it is not an issue
with 2008 (the serial appears as 0 in the table, as you described, until
it is checked-in and refreshed).
To add details, the error response from 2010 when trying to check-in a
new feature:
<Error code="200" type="5" dispensation="3" sId="2"
occurrence="1">Feature was not saved in the target feature
source.<Parameters>
<Parameter classId="0" position="0">
<Message>2=Invalid property value name 'gid'.
</Message>
<SQL></SQL>
</Parameter>
<Parameter classId="0" position="0">
<Message>1=Failed to execute Fdo command.
</Message>
<SQL></SQL>
</Parameter>
<Parameter classId="0" position="0">
<Message>Failed to insert feature.</Message>
<SQL></SQL>
</Parameter>
<Parameter classId="0" position="0">
<Message>FdoPostGIS:mytable (), Rev# <0></Message>
<SQL></SQL>
</Parameter></Parameters>
<Entry code="1" type="15" sId="3" occurrence="1">Failed to save some
features.</Entry>
<Entry code="1" type="15" sId="4" occurrence="1">Failed to save edit
set.</Entry>
</Error>
In QGIS and other programs, the default value for a serial (integer)
that is shown in the property before insert/commit is
"nextval('mytable_gid_seq'::regclass)", which might explain the error
message "Invalid property value name 'gid'", since it appears as a
string, not an integer in this form.
I tried fixing this with some trigger functions within the database, but
whatever I've tried I can't seem to make a workaround. The best I can do
is raise some exception in a before trigger, which shows up in the error
message in AutoCAD, but making a trigger that sets "NEW.gid :=
nextval('mytable_gid_seq'::regclass);" still throws the error shown
above.
Is this an issue with FDO or with AutoCAD Map3D 2010?
-Mike
David Anderson wrote:
>
> I have been trying to setup Map 3D 2010 to access a PostGIS database
> that has a feature set to auto increment the primary key. When trying
> to create a new feature, Map 3D complains about the gid being invalid
> because it tries to add it as 0. Map 3D won't let me change the value
> because it is controlling it. If I check in the feature, close the
> drawing, reopen the drawing Map 3D shows the feature even though it
> was saying it couldn't be added. I have tried with various
> combinations of PostgreSQL 8.2 & 8.3 and PostGIS 1.3.4-1.3.6 with the
> same results.
>
> Is anybody successfully using Map 3D with the auto increment setting?
> Does this only work with a certain data type? Any help would be
> greatly appreciated.
>
> QGIS and uDig both access the database properly and can add features
> so the database is working in that respect.
>
> Thanks,
>
> David
>
>
------------------------------------------------------------------------
>
> _______________________________________________
> fdo-users mailing list
> fdo-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-users
>
_______________________________________________
fdo-users mailing list
fdo-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-users
More information about the fdo-users
mailing list