I am Stephen, who asked the original question.
The trigger is required to make a view writable in Postgres so I can't test without it - it runs on insert, update and delete.
loopback:connector:postgresql SQL: INSERT INTO "public"."project_geom" ("ref","project_geom") SELECT $1,$2 RETURNING
Parameters: 124,{"type":"Polygon","coordinates":[[[-0.1028144359588623,51.37445934986937],[-0.10126948356628418,51.37301272340493],-0.09850144386291503,51.37462008332153],[-0.10086178779602051,51.37537016530327],[-0.1028144359588623,51.37445934986937]]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}} +2ms
The full error message is below:
loopback:connector:postgresql error: syntax error at end of input
at Connection.parseE (C:\Bitnami\wappstack-5.4.30-0\apache2\htdocs\project\api\node_modules\loopback-connector-postgresql\node_modules\pg\lib\connection.js:534:11)
at Connection.parseMessage (C:\Bitnami\wappstack-5.4.30-0\apache2\htdocs\project\api\node_modules\loopback-connector-postgresql\node_modules\pg\lib\connection.js:361:17)
at Socket.<anonymous> (C:\Bitnami\wappstack-5.4.30-0\apache2\htdocs\project\api\node_modules\loopback-connector-postgresql\node_modules\pg\lib\connection.js:105:22)
at Socket.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:765:14)
at Socket.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:427:10)
at emitReadable (_stream_readable.js:423:5)
at readableAddChunk (_stream_readable.js:166:9)
at Socket.Readable.push (_stream_readable.js:128:10) +15ms
If I run the following query: INSERT INTO project_geom (ref,project_geom) VALUES (124,'{"type":"Polygon","coordinates":[[[-0.1028144359588623,51.37445934986937],[-0.10126948356628418,51.37301272340493],[-0.09850144386291503,51.37462008332153],[-0.10086178779602051,51.37537016530327],[-0.1028144359588623,51.37445934986937]]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'::json);
I am able to insert the value without issue.The view schema is (ref:integer, project_geom::json)
Is this of any help? I guess the problem is in the type handling somewhere.
Stephen