Using array_agg in pgr_kdisjkstrpath()

From: Marc-André Goderre <magoderre(at)cgq(dot)qc(dot)ca>
To: "'pgsql-general(at)postgresql(dot)org' (pgsql-general(at)postgresql(dot)org)" <pgsql-general(at)postgresql(dot)org>
Subject: Using array_agg in pgr_kdisjkstrpath()
Date: 2015-04-09 13:40:16
Message-ID: D8DAC91BA6256246BA3FF835F6AAA1189943BE27@SI-MB01.cegep-chicoutimi.qc.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all,
I hope someone will can help me.

When I use pgr_kdijkstrapath function as this:

select * FROM pgr_kdijkstrapath('
SELECT d.id,
source::integer,
target::integer,
c.cost::double precision as cost
FROM way_topo_data d join way_cost c on d.id = c.id
where c.profile_id=5',
(select n1.start_id::integer from n1),
(select array_agg(end_id::integer)::integer[] as id from n2),
false,
false) p;

It return me the following error : One of the target vertices was not found or several targets are the same.

But when i take the result of the
(select array_agg(end_id::integer) ::integer[] as id from n2)
giving me "{28411,25582}" and hardcode it in the the statement as :

select * FROM pgr_kdijkstrapath('
SELECT d.id,
source::integer,
target::integer,
c.cost::double precision as cost
FROM way_topo_data d join way_cost c on d.id = c.id
where c.profile_id=5',
(select n1.start_id::integer from n1),
'{28411,25582}',
false,
false) p;

It works
Then, where's the difference between the result of (select array_agg(end_id::integer)::integer[] as id from n2) AND '{28411,25582}'

Thanks
Marc-André

Marc-André Goderre
Analyste en informatique
[LOGO-FINAL-1_Mini.png]

Courriel: magoderre(at)cgq(dot)qc(dot)ca<mailto:magoderre(at)cgq(dot)qc(dot)ca>
Tel.: (418) 698-5995 poste 1628
Téléc.: (418) 698-4108
Cégep de Chicoutimi, 534 rue Jacques-Cartier Est, Chicoutimi (Québec) G7H 1Z6

Visitez notre site web au : www.cgq.qc.ca<http://www.cgq.qc.ca/>
Suivez-nous sur Twitter : @lecgq<https://twitter.com/lecgq>

AVIS DE CONFIDENTIALITÉ :
Le présent courriel peut contenir des renseignements confidentiels s'adressant qu'au destinataire ou à celui ont le nom figure ci-dessus. Si ce courriel vous est parvenu par mégarde, veuillez le supprimer et nous en aviser aussitôt par téléphone. Merci.
P Pensez à l'environnement avant d'imprimer ce message

Browse pgsql-general by date

  From Date Subject
Next Message John McKown 2015-04-09 13:53:16 Re: Cannot connect from local network to my postgresql server
Previous Message Adrian Klaver 2015-04-09 13:28:34 Re: Cannot connect from local network to my postgresql server