We have window function version of first_value(),
but aggregate version looks useful to write queries something like:

=# CREATE TABLE obj (id integer, pos point);
=# SELECT X.id,
          first_value(Y.id ORDER BY X.pos <-> Y.pos) AS neighbor
   FROM obj X, obj Y
   GROUP BY X.id;

Is it reasonable? Or, do we have alternative ways for the same purpose?

-- 
Itagaki Takahiro

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to