7

While I'm adding a geometry column in PostGIS by using AddGeometryColumn then the error is

no function matches the given name and argument types. you might need to add explicit type casts

  • 2
    may be you could add the actual statement you are trying? – Ian Turton Oct 17 '12 at 7:32
  • Could you provide some input on this question? or pick a chosen answer? – Evan Carroll Jan 5 '17 at 4:44
6

First, as others have said, make sure you have PostGIS installed. Run this command to ensure that you have PostGIS installed,

SELECT postgis_version();

If you don't have postgis_version() then you need to install PostGIS on the database. If it's not installed, you can try this when connected to the specific database you want to install PostGIS on,

CREATE EXTENSION postgis;

If that fails than you need to install or build PostGIS which then becomes a question of what operating system you're using. If you've got the extension downloaded and installed, run this in psql

\dfS AddGeometryColumn

If that works, then you have the function installed too but you're providing it the wrong types. We need the actual function call. Provide us what you're calling AddGeometryColumn() with. Also, if your version of PostGIS is newer than 2.0, do not use AddGeometryColumn(). It is not needed. Instead use the ALTER TABLE ADD COLUMN with the subtype. Here is an example to add a geometry point in srs 4326.

ALTER TABLE some_table ADD COLUMN geom geometry(Point,4326);
2

i think because of these error arise from lack of postgis extension of postgres or not proper installation and its dependencies.

you can take more info here about proper installation.

sudo apt-get install pgadmin3 postgresql-9.1-postgis

i hope it helps you...

  • ya i got it by using default postgis data base "template_postgis" – Satya Chandra Oct 18 '12 at 9:30
  • This is specific to a certain version of postgresql, and pgadmin3 has nothing to do with the presence of a PostGIS function. – Evan Carroll Dec 6 '16 at 22:54
1

If PostGIS is properly installed, is the schema you installed the PostGIS functions to in your search path? You can check by using

SHOW search_path;

By default the PostGIS functions are installed in the public schema, so if public's in your search path and you've either installed the PostGIS extension for PostGIS or run the old sql install script then you're probably not providing the correct arguments to AddGeometryColumn. Did you use single quotes around the schema, table, and column names? Did you leave the quotes off when supplying the SRID and dimension arguments?

1

As per the guides, the best test for determining whether your installation is correct is going to be via CREATE EXTENSION PostGIS; run from psql or PgAdmin.

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.