# PostgreSqlFeatureSource crashes when inserting with WhereClause

**URL:** <https://community.thinkgeo.com/t/postgresqlfeaturesource-crashes-when-inserting-with-whereclause/10084>\
**Category:** WPF\
**Created:** [May 27, 2021, 8:52am UTC](https://community.thinkgeo.com/t/postgresqlfeaturesource-crashes-when-inserting-with-whereclause/10084 "2021-05-27T08:52:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clemens\_Ladisch](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/clemens_ladisch/32/25138_2.png) [@Clemens\_Ladisch](https://community.thinkgeo.com/u/Clemens_Ladisch)\
**Post date:** [May 27, 2021, 8:52am UTC](https://community.thinkgeo.com/t/postgresqlfeaturesource-crashes-when-inserting-with-whereclause/10084/1 "2021-05-27T08:52:48Z")

</div>

When I have a PostgreSqlFeatureLayer with a WhereClause set and try to insert a feature, the CommitTransaction call fails.

The server log shows that the WHERE clause was appended to the INSERT statement, e.g.:

```
ERROR: syntax error at or near "WHERE" at character 103
STATEMENT: insert into "myschema"."mm_tr_lm_stations" ("GEOLOC","MI_STYLE") values(ST_GeomFromWKB($1,28992),$2) WHERE "TRSTATUS" = 0
```

---

<div class="post-metadata">

**Author:** ![Kyle\_Day](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/kyle_day/32/25613_2.png) [@Kyle\_Day](https://community.thinkgeo.com/u/Kyle_Day)\
**Post date:** [May 27, 2021, 2:30pm UTC](https://community.thinkgeo.com/t/postgresqlfeaturesource-crashes-when-inserting-with-whereclause/10084/2 "2021-05-27T14:30:33Z")

</div>

Hey @Clemens_Ladisch,

Good catch. That’s not supposed to happen. I’ve pushed up a fix into our develop branch and should be available in NuGet for the following packages later today:

- ThinkGeo.Core v13.0.0-beta275
- ThinkGeo.PostgreSql v13.0.0-beta265

Thanks,  
Kyle
