I'm trying to create a function which calculates the nearest neighbors under a certain length in a table s_1 an stores them in an output table.
This is what I've got so far:
CREATE OR REPLACE FUNCTION NearestN()
RETURNS TABLE (
a integer,b integer,ST_Distance integer)AS
$$
SELECT...