1

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
)
3
  • Please identify the row that makes the query fail and show the data. Also the CREATE TABLE statement for sites would be helpful. Commented Apr 14 at 5:20
  • 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 : Commented Apr 15 at 8:38
  • Please edit the question and add the information there. Commented Apr 15 at 9:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.