In QGIS, i would like to create a new layer containing the beginning and end points of a polylines layer, but without the duplicate points that would result of adjacent polylines.
As my layers loaded in QGIS Map Canvas are loaded from postgis, i used the st_endpoint() and st_startpoint() Postgis functions to find the start and end point of each polyline and i made a union of both SQL to remove the duplicates. It works perfect loading the SQL with the DB Manager to QGIS Map Canvas. I added a (row_number() OVER () AS id) sentence to create a unique identifier that the DB Manager needed. The query would be:
SELECT (row_number() OVER () AS id, A1."GEOMETRY" FROM (SELECT DISTINCT st_endpoint(YOUR_TABLE."GEOMETRY") AS "GEOMETRY" FROM YOUR_TABLE) UNION (SELECT DISTINCT st_startpoint(YOUR_TABLE."GEOMETRY") AS "GEOMETRY" FROM YOUR_TABLE)) AS A1;