I am in the process of restoring a database that relied on PostGIS version 1.5 functions to a newer Postgresql engine that leverages PostGIS 2.2 functions. In my restore process, I receive the following error:

pg_restore: [archiver (db)] could not execute query: ERROR: function srid(geometry) does not exist.

I know this error is caused by a constraint on one of my tables that utilizes the srid(geometry) function. I want to alter the constraint to use the new function name -- if it exists. Has this function been removed or has it been renamed since PostGIS version 1.5?

I am unable to use the legacy PostGIS functions because I am restoring to an AWS RDS instance. RDS instances do not allow the creation of functions that use C language libraries from the underlying OS for security reasons. That is why I am in this situation.

1 Answer 1


The function has indeed been renamed.

In Postgis 2.0, use ST_srid.

Alternatively, following https://github.com/mapbox/osm-bright/issues/45 you can use legacy.sql or legacy_minimal.sql to bring those old functions into Postgis 2.0 for compatibility. You might find them in C:\Program Files\PostgreSQL\<version>\share\contrib\postgis-<version>\ for Windows installations.

  • I will try st_srid in place of srid and see what happens on restoration of the database. Once I finish that process I will update this thread with my results.
    – brogan
    Aug 18, 2016 at 16:25
  • I would use the legacy.sql script and have in the past when restoring to a database server that I completely control. I am restoring to an AWS RDS instance, which does not accept function creation that use underlying C language libraries that are stored on the OS disk. I receive an error like this: pg_restore: [archiver (db)] could not execute query: ERROR: permission denied for language c.
    – brogan
    Aug 18, 2016 at 16:28
  • After changing the name to the correct and updated one I was able to continue the restore process. Thanks!
    – brogan
    Aug 19, 2016 at 13:35

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.