I am really confused. I have this postgis query :
with
f as ( SELECT
ST_AsGeoJSON(p.geompos)::json As geometry,
row_to_json((p.id_client, p.design_site, p.adresse)) As properties
FROM sites p
where p.id_client ilike '1%'
),
fc as ( SELECT
'FeatureCollection' As type,
array_to_json(array_agg(f)) As features
FROM f
)
SELECT row_to_json(fc) FROM fc
It work fine. But when I use a condition :
where p.id_client not ilike '1%'
I got the error message :
ERROR: input of anonymous composite types is not implemented
SQL state: 0A000
I think that some geometry data make problem. How can I fix this? I have more than 22000 rows and this is why I can not find the row who make the problem. and this is the ddl of the sites table :
CREATE TABLE IF NOT EXISTS public.sites
(
idsite serial,
id_client character varying(8) COLLATE pg_catalog."default",
design_site character varying(1024) COLLATE pg_catalog."default",
adresse character varying(1024) COLLATE pg_catalog."default",
geompos geometry,
CONSTRAINT pk_sites PRIMARY KEY (idsite),
CONSTRAINT fk_sites_associati_ref_clie FOREIGN KEY (id_client)
REFERENCES public.ref_client (id_client) MATCH SIMPLE
ON UPDATE RESTRICT
ON DELETE RESTRICT
)
CREATE TABLEstatement forsiteswould be helpful.