erasmus77
erasmus77

Reputation: 327

How does select work in postgresql, postgis?

I have the following statement in a book:

SELECT AddGeometryColumn('public','my_geometries','my_points',-1,'POINT',2);
INSERT INTO my_geometries (name,my_points) 
VALUES ('Home',ST_GeomFromText('POINT(0 0)')); 

I understand the insert into, values part but the first statement is a bit unclear. In the book they say they're creating a new point by using the SELECT statement.

So how can this work?

SELECT AddGeometryColumn('public','my_geometries','my_points',-1,'POINT',2);

By looking at the api http://postgis.refractions.net/docs/AddGeometryColumn.html it seems it adds a new column but how does the select work since that object isn't created? How can it select?

Upvotes: 0

Views: 73

Answers (1)

pleasedontbelong
pleasedontbelong

Reputation: 20102

In postgresql you use SELECT to call functions. cf: http://www.postgresql.org/docs/9.1/static/sql-syntax-calling-funcs.html

for example : SELECT RANDOM(); will call the random function and display a random number.

hope this helps

Upvotes: 2

Related Questions