Mega Code Archive

 
Categories / PostgreSQL / Data Type
 

Using point data type in insert statement

postgres=# CREATE TABLE emp ( postgres(#    name        text, postgres(#    salary      numeric, postgres(#    age         integer, postgres(#    cubicle     point postgres(# ); CREATE TABLE postgres=# postgres=# insert into emp (cubicle) values (point(0,0)); INSERT 0 1 postgres=# insert into emp (cubicle) values (point(2,1)); INSERT 0 1 postgres=# postgres=# postgres=# SELECT * postgres-#    FROM emp postgres-#    WHERE emp.cubicle ~= point '(2,1)';  name | salary | age | cubicle ------+--------+-----+---------       |        |     | (2,1) (1 row) postgres=# postgres=# postgres=# drop table emp; DROP TABLE postgres=#