Skip to content

Instantly share code, notes, and snippets.

@vincentdesmares
Created May 11, 2017 22:57
Show Gist options
  • Save vincentdesmares/871986eaec36cf723dca080d66141e3b to your computer and use it in GitHub Desktop.
Save vincentdesmares/871986eaec36cf723dca080d66141e3b to your computer and use it in GitHub Desktop.
-- Create the master table tablename_with_partition:
-- You should use the same exact schema as the one from the non partitioned table.
CREATE TABLE tablename_with_partition
(
id integer NOT NULL DEFAULT nextval('tablename'::regclass),
"name" character varying(150) NOT NULL,
description text NOT NULL,
period character varying(10) NOT NULL
CONSTRAINT tablename_with_partition_pkey PRIMARY KEY (id)
) WITH ( OIDS=FALSE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment