0

Using the "function to cut linestings and multilinestrings at nearest point junctions" found in chapter 11 of the book PostGIS in Action by Regina Obe and Leo Hsu (Second Edition)

It returns this error when running in PgAdmin 4:

ERROR:  syntax error at or near "END"
LINE 40:    END IF;
            ^
********** Error **********

ERROR: syntax error at or near "END"
SQL state: 42601
Character: 1064

Code lines around line 40:

        ELSE
         var_lset[j] := kutt(var_lset[j],var_pset[i])
        END IF;

What is wrong?

2

The reason is simple, missing semi-colon on the end of this line:-

  kutt(var_lset[j],var_pset[i]);

It has nothing to do with Postgis being installed

  • Thnx! Any idea why it still won't run in SQL Shell (psql) ERROR: type geometry does not exist – Fjellrev Feb 15 '17 at 9:01
  • 1
    That is down to Postgis not being installed ;-) Try CREATE EXTENSION postgis; – CitizenFish Feb 15 '17 at 9:12
0

I guess you haven't installed PostGIS in the database.

Run

Create extension PostGIS;

before creating the function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.