I'm figuring out how to use the PostGIS
extension, and I found a nice tutorial: http://postgis.net/workshops/postgis-intro/geometries.html.
First the tutorial directs to create a table:
CREATE TABLE geometries (
name varchar,
geom geometry
);
Then insert into that table
insert into geometries (name, geom)
values
('Point', 'point(0 0)');
Then, looking at what other column types I can use with the PostGIS
addon, I found that I can use the point
type directly:
create table points (
name varcar,
point point
);
insert into points (name, point)
values
('point 1', point(0, 1));
(Notice that the inserted value into the point
column is NOT wrapped in quotes)
Trying to insert a point into the geometries
table without wrapping the value in a quote fails:
insert into geometries (name, geom)
values
('Point', point(0 0));
SQL Error [42601]: ERROR: syntax error at or near "0"
This seems like it might be significant... If a column of type point
allows for inserting values defined via that type (point(0 0)
) - I assume this isn't a normal SQL function call? -, why can't I do the same for a column of type geometry
?
POINT
type is a native PostgreSQL geometric type, independent from PostGIS and incompatible with it's functionality. Most types come with built in (implicit) type cast from common input types; this is why PostGISGEOMETRY
type accepts a valid WKT string representation.