[fdo-users] Cannot insert to PostGIS
brent.robinson at autodesk.com
Fri Jun 18 08:52:50 EDT 2010
This exception occurs when the class is abstract or has no identity properties. I'm not sure why it happens in this particular case; the class was generated from an existing table so it should be non-abstract, and one identity property should have been generated from the primary key column.
The class definition generated can be checked by executing a FdoIDescribeSchema command and then navigating to the class definition, something like:
using (IDescribeSchema descCommand =
FeatureSchemaCollection schemas = descCommand.Execute();
FeatureSchema schema = schemas.FindItem("ShipSysSchema");
classDefinition classDef = schema.classes.FindItem("Ship");
Boolean isAbstract = classDef.isAbstract;
Int idCount = classDef.identityProperties.Count;
I don't work much in C# so the above might need some changes.
Another this that was curious is that the error message reports the class as ' Ship' with a leading blank. Was the blank in the original message or just a typo in the posting?
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of hanko
Sent: Friday, June 18, 2010 5:37 AM
To: fdo-users at lists.osgeo.org
Subject: [fdo-users] Cannot insert to PostGIS
I'm using the FDO PostgreSQL ("OSGeo.PostgreSQL.3.5") provider to connect to
my PostGreSQL 8.2 + Postgis 1.4 database.
I have an exception when i try to insert data with IInsert command.
My table in PostGIS (created with FDO):
CREATE TABLE "ShipSysSchema"."Ship"
"ID" bigint NOT NULL DEFAULT
"Test" character varying(255) NOT NULL,
"Velocity" double precision NOT NULL,
"Direction" double precision NOT NULL,
CONSTRAINT pk_shipsysschema_ship PRIMARY KEY ("ID"),
CONSTRAINT "Ship_Direction_check" CHECK ("Direction" >= 0::double
precision AND "Direction" <= 360::double precision),
CONSTRAINT "Ship_Velocity_check" CHECK ("Velocity" >= 0::double precision
AND "Velocity" < 100::double precision),
CONSTRAINT "enforce_dims_Geom" CHECK (ndims("Geom") = 2),
CONSTRAINT "enforce_srid_Geom" CHECK (srid("Geom") = 3007)
public void Insert()
using (IInsert insertCommand =
insertCommand.SetFeatureClassName("Ship"); // <- I get exception here
IsertData(insertCommand, 10.5, 12.5, 11, 4);
OSGeo.FDO.Common.Exception was caught
Message="Creating/Updating a standalone instance for class ' Ship' is not
Do you have an idea why ?
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Cannot-insert-to-PostGIS-tp5194654p5194654.html
Sent from the FDO Users mailing list archive at Nabble.com.
fdo-users mailing list
fdo-users at lists.osgeo.org
More information about the fdo-users