<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>I can tell that when creating an explicit CAST like:</div>
<div> </div>
<div>CREATE CAST (jsonb AS geometry) WITH FUNCTION ST_GeomFromGeoJSON(jsonb);<br/>
</div>
<div>I'm able to do:</div>
<div>SELECT '{"type":"Point","coordinates":[1,1]}'::jsonb::geometry</div>
<div>
<div> </div>
<div>But my jsonb_populate_record requires an implicit cast from text to geometry:</div>
<div>SELECT * FROM jsonb_populate_record(NULL::spatial_table, (SELECT to_jsonb(t.*) FROM (SELECT * FROM spatial_table LIMIT 1) t));</div>
<div> </div>
<div>So probably geometry(text) just needs to be able to understand GeoJSON, too.</div>
<div> </div>
<div> </div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Freitag, 06. März 2020 um 10:50 Uhr<br/>
<b>Von:</b> "Felix Kunde" <felix-kunde@gmx.de><br/>
<b>An:</b> postgis-devel@lists.osgeo.org<br/>
<b>Betreff:</b> [postgis-devel] Cast GeoJSON to geometry like with WKT</div>
<div name="quoted-content">Hey there,<br/>
<br/>
maybe there's already an open issue/ticket for this - did not search that long. So sorry just in case.<br/>
<br/>
I'm happy about the new geometry::jsonb cast feature, but just found out that it breaks my audit trail software where I log changes as JSONB.<br/>
One feature is to restore previous versions, so transferring the JSONB logs back to their relational counterparts with jsonb_populate_record function.<br/>
<br/>
Before, this was no problem as the WKB ended up in JSONB and could be reused to create PostGIS geometries.<br/>
But with the new behavior, I can only use ST_GeomFromGeoJSON if I'm not mistaken.<br/>
It would be nice if there would be a more "native" way, e.g. like what we have for WKT where I can write 'POINT(1 1)'::geometry.<br/>
<br/>
So something like: SELECT '{"type":"Point","coordinates":[1,1]}'::geometry<br/>
<br/>
I'm not 100% sure if this would solve my problem ^^<br/>
Is it something you like to have and think it's possible?<br/>
I might try to implement, if you think it's shouldn't be too hard.<br/>
<br/>
Kind regards<br/>
Felix<br/>
<br/>
PS: Btw, was there ever a discussion to do WKB::text = WKT? :)<br/>
_______________________________________________<br/>
postgis-devel mailing list<br/>
postgis-devel@lists.osgeo.org<br/>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a></div>
</div>
</div>
</div></div></body></html>