ThinkGeo.com    |     Documentation    |     Premium Support

PostgreSqlFeatureSource does not correctly quote feature ID column

(ThinkGeo.UI.Wpf 12.1.3, ThinkGeo.PostgreSql 12.1.3)

When I try to show a layer that has uppercase column names:

var layer = new PostgreSqlFeatureLayer("Host=localhost;Username=postgres", "mm_tr_sm",
                                       "MI_PRINX", 28992, "testprj", "GEOLOC");

then I get just an error message in the map:

The server’s log shows that the feature ID column name is not quoted:

 ERROR:  column "mi_prinx" does not exist at character 42
 STATEMENT:  select st_asbinary("GEOLOC") as "GEOLOC",MI_PRINX from "testprj"."mm_tr_sm" where ST_GeomFromWKB($1,28992) && "GEOLOC"

If I try to add quotes to the string, the map display itself works, but other functions that do quote correctly blow up:

var layer = new PostgreSqlFeatureLayer("Host=localhost;Username=postgres", "mm_tr_sm",
                                       "\"MI_PRINX\"", 28992, "testprj", "GEOLOC");
layer.Open();
layer.FeatureSource.GetBoundingBoxById("1");
 ERROR:  zero-length delimited identifier at or near """" at character 85
 STATEMENT:  select st_asbinary("GEOLOC") as "GEOLOC","MI_PRINX" from "testprj"."mm_tr_sm" where ""MI_PRINX"" in ('1')

Hi Clemens,

Thank you very much for report this issue, it’s proved to be a bug in SDK, it has been fixed in the latest develop branch, in other words, you can try update ThinkGeo.PostgreSql to version higher or equal to 13.0.0-beta043 to get it fixed. After this fix applied, don’t need to add “quotes” to the string, just keep the code of creating instance as following:

var layer = new PostgreSqlFeatureLayer("Host=localhost;Username=postgres", "mm_tr_sm",
                                       "MI_PRINX", 28992, "testprj", "GEOLOC");

please take a try at first, if everything goes well on your side, I will talk with guys to see if it can be merged into master branch later.

Regards,
Johnny

beta043 works fine.
Thanks!

Hi Clemens,

Thanks for your feedback, any question please feel free to let us know.

Regards,

Ethan