ASP.NET application gives 'type "geometry" does not exist error

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
DanielTulp
Posts: 5
Joined: Fri 25 Aug 2017 08:06

ASP.NET application gives 'type "geometry" does not exist error

Post by DanielTulp » Fri 25 Aug 2017 08:09

I have a local Postgres 9.5 with Postgis 2.2.1 installation (I had 2.3.5 installed, but that gave me the same problems so I tried this one).
I can confirm Postgis is indeed installed when I open the extensions installed on the database, it is installed in the public schema, my ASP.NET application uses a different schema. The search_path for the database is "$user", public, topology.

I use the devart connector to connect my Asp.NET application to the database.

All the spatial stuff seems to work in the database itself (I have several views that use functions and tables that have spatial data types), however when my application hits something with a spatial type in it, I get the error "type “geometry” does not exist".

The weird thing is that I do not have this problem with my staging and production environment. They run on Postgres 9.4 with Postgis 2.2 installed. Here the Postgis extension is also allocated to the public schema.

When I reallocated the postgis extension to the schema my app uses, the error goes away, but this isn't a defenite solution.

using dotConnect for PostgreSQL version 7.7.819.0 on windows 10 x64 platform.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: ASP.NET application gives 'type "geometry" does not exist error

Post by Shalex » Tue 29 Aug 2017 16:42

Make sure that you are using exactly the same credentials via the code and via pgAdmin III. Please execute this code in your application:

Code: Select all

    using (var conn = new PgSqlConnection())
    {
        conn.ConnectionString = "... initial schema=topology;";
        conn.Open();
        var cmd = conn.CreateCommand();
        cmd.CommandText = "CREATE TABLE topology.test (id integer PRIMARY KEY, geom public.geometry)";
        cmd.ExecuteNonQuery();
    }
If the issue persists, we think that it is caused by configuration of your PostgreSQL Server v9.5.

We cannot reproduce the problem in our environment.

Post Reply