I am trying to port an Oracle database over to Postgres by editing scripts generated within Oracle and have come across some geometry type columns. I am using PostGIS in order to allow me to use geometry types and am adding the columns using the following:
CREATE TABLE TABLE_NAME
(
ID BIGINT NOT NULL,
GEOM GEOMETRY,
CENTROID GEOMETRY,
R_CENTROID GEOMETRY,
NUM_POINTS BIGINT,
PK BIGINT,
EXTENT GEOMETRY
);
This passes ok in the editor however the generated Oracle script specifies how to store the data in the geometry column as follows:
VARRAY "R_EXTENT"."SDO_ELEM_INFO" STORE AS LOB (
ENABLE STORAGE IN ROW
CHUNK 8192
RETENTION
CACHE
LOGGING
INDEX (
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
))
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
))
This is just one column of course but how can this be achieved in postgres? Or more to the point can it be done full stop.
You can ignore the storage settings from the Oracle script. They only deal with the physical storage of the column values and don’t influence the usage of the column at all.
PostgreSQL handles custom data types differently.
Just keep your original
CREATE TABLEyou don’t need to change anything.