TransWikia.com

PostgreSQL/PostGIS cast geometry column of joined table to varchar while creating another table

Geographic Information Systems Asked by idrizza on July 23, 2021

A simple SELECT on a table with a geometry column works, but creating a table from this query automatically cast the column to varchar.

Here is the query:

CREATE TABLE importe AS
SELECT fid, id, structure_, validite, visible, nom, commentair, depart, arrivee, confort, "source", "enjeu_d'en",
usages, reseaux, "date_d'ins", date_de_mo, communes, secteurs, zonage_reg, longueur_2, longueur_3, denivele_p,
denivele_n, altitude_m, altitude_1, pente, layer, "path", e.geom
FROM rlesi_nord r
LEFT JOIN ma_topo.edge_data e ON (r.topo).id = e.edge_id;

ma_topo is my topology schema, edge_data is the table from which I get the geom for importe rows.

I tried to explicitly cast it to geometry but it doesn’t change anything:

e.geom::geometry

There isn’t a problem when I create a table with a geom column which belongs to the table of the FROM clause (and not of the JOIN like my initial query).

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP