Mám tabulku, **majetek **se záznamy z postgis souřadnice sloupce geoarea(Body), a bool sloupec within_area(Bool) k určení, zda její vnitřek, že další postgis st_union(Polygon) z tabulky urbanArea
select properties.id, ST_Within(properties.geoarea,st_transform("urbanArea"."st_union",2393)) from properties,"urbanArea"
což mě vrací všechny záznamy v vlastnosti podle id, a bool hodnotu, pokud jeho rámci této oblasti nebo ne. To trvá asi 10 sekund k provedení dotazu
Rád bych nyní získat hodnoty z select a vložte ji do within_area sloupci, jsem přišel s tímto SQL dotaz, ale to visí navždy a nemá konce, nějaký nápad, proč?
UPDATE properties p
SET within_area = (
with newarea as (select properties.id, ST_Within(properties.geoarea,st_transform("urbanArea"."st_union",2393)) as "isInside" from properties,"urbanArea")
select u."isInside" from newarea u where u.id = p.id
)
Já jsem se stejně snažil dělat to s CTE přesto stále visí navždy.
with newarea as (select properties.id, ST_Within(properties.geoarea,st_transform("urbanArea"."st_union",2393)) from properties, "urbanArea")
UPDATE properties
SET
withinurban=newa.st_within
FROM properties prop
INNER JOIN
newarea newa
ON prop.id = newa.id