[postgis-users] PostGIS 2.1 CREATE EXTENSION vs Loading postgis.sql and spatial_ref_sys.sql

Puthick Hok hputhick at gmail.com
Tue Feb 3 21:05:00 PST 2015


BladeOfLight16 wrote:
> On Tue, Feb 3, 2015 at 11:41 PM, Puthick Hok <hputhick at gmail.com 
> <mailto:hputhick at gmail.com>> wrote:
>
>     I use Perl DBI to connect to Postgresql. If I create the postgis
>     database using 'CREATE EXTENSION' method, Perl DBI returns
>     'layer_id' as the primary key of my layer table. If I create the
>     postgis database using the old incompatible way of loading
>     postgis.sql and spatial_ref_sys.sql, Perl DBI returns 'id' as it
>     is named as the primary key of my layer table.
>
>
> That doesn't make sense. I'm pretty sure that neither CREATE EXTENSION 
> nor running postgis.sql and spatial_ref_sys.sql would affect the 
> primary key of an existing table. Most likely, you're running some 
> other SQL of your own, and you have something weird going on in that. 
> How are you creating your "layer table"?
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
My create table and index are:

CREATE TABLE layer (
    id integer NOT NULL,
    parent bigint NOT NULL,
    name character varying(100) NOT NULL,
    alias character varying(100),
    layertype character varying(30) DEFAULT 'layer'::character varying 
NOT NULL,
    layermetadata text,
    iseditable smallint DEFAULT 1 NOT NULL,
    createuser bigint DEFAULT 0 NOT NULL,
    createtime timestamp without time zone NOT NULL,
    lastupdateuser bigint NOT NULL,
    lastupdatetime timestamp without time zone NOT NULL,
    srid bigint DEFAULT 4326 NOT NULL,
    geometrytype character varying(30),
    description character varying(254),
    owngroupid bigint NOT NULL,
    accessgroupid bigint DEFAULT 0 NOT NULL,
    owngroupperm smallint NOT NULL,
    accessgroupperm smallint DEFAULT 0 NOT NULL,
    otherperm smallint DEFAULT 0 NOT NULL
);

CREATE SEQUENCE layer_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.layer_id_seq OWNER TO auser;

ALTER SEQUENCE layer_id_seq OWNED BY layer.id;

SELECT pg_catalog.setval('layer_id_seq', 1, false);

ALTER TABLE ONLY layer
    ADD CONSTRAINT layer_pkey PRIMARY KEY (id);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150204/efabeeb8/attachment.html>


More information about the postgis-users mailing list