Simon GIS
Simon GIS

Reputation: 1055

ST_Intersect on polygons PostGIS : argument of JOIN/ON must be type boolean, not type record

I am using this code in PostGIS to inner join two polygons files.

My tables:

table p : vietnamgis.vnm_adm3

ID geom        ADM1       .... ....
1  01600000..   tan bin
2  01600000..   san 
3  01600000..   dan


Table b : vietnamgis.cadastrewfg

gid  geom        description  ... ...
1    01600000..   house
2    01600000..   commercial
3    01600000..   house

My code

DROP TABLE IF EXISTS public.overlap;
CREATE TABLE public.overlap AS
SELECT b.geom As bgeom, p.geom As pgeom, 
         ST_Intersection(b.geom, p.geom) As intersect_bp
    FROM vietnamgis.cadastrewfg b INNER JOIN vietnamgis.vnm_adm3 p ON (b,p)
    WHERE ST_Overlaps(b.geom, p.geom)
    LIMIT 1;

I did create before CREATE EXTENSION postgis;

SELECT PostGIS_Version();
3.0 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
ERROR:  argument of JOIN/ON must be type boolean, not type record
LINE 5: ...mgis.cadastrewfg b INNER JOIN vietnamgis.vnm_adm3 p ON (b,p)
                                                              ^

What is wrong here, how can I fix to join my polygons files?

Upvotes: 1

Views: 4390

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133370

Your join clause seems wrong: instead of the table aliases (b and p) you should compare the related keys columns, for example:

FROM vietnamgis.cadastrewfg b 
INNER JOIN vietnamgis.vnm_adm3 p ON b.you_b_col_ley = p.you_p_col_key 

Upvotes: 2

Related Questions