pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Scalia <jayknowsunix@gmail.com>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Creating a partition table
Date: Fri, 30 Oct 2020 12:52:49 -0400
Message-ID: <BFBB87D2-4AFB-4B2A-A140-E19860849936@gmail.com> (raw)

Hi all,

I have a PostgreSQL server version 11.3 that my devs are asking for some partitioned tables. I can’t seem to get the syntax correct though. My SQL code is:

CREATE TABLE schema.temp_table
AS (SELECT * FROM schema.original_table)
PARTITION BY LIST(attribute_name);

As what I want to do is create a copy of the current table, create the partitions on the new temp table, and when everything works, drop the original table and do an alter table rename on the new one.

The error is:
ERROR: syntax error at or near “PARTITION”
Line 3: PARTITION BY LIST(attribute_name);

I’ve tried using the word RANGE as opposed to LIST, but the error remains. Does PostgreSQL not support a construct like this one or am I doing something wrong?
—
Jay

Sent from my iPad




view thread (6+ messages)  latest in thread

Message-ID: <BFBB87D2-4AFB-4B2A-A140-E19860849936@gmail.com>
Permalink:  ../BFBB87D2-4AFB-4B2A-A140-E19860849936@gmail.com/
Also on:    postgresql.org/message-id/BFBB87D2-4AFB-4B2A-A140-E19860849936@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: jayknowsunix@gmail.com
  Subject: Re: Creating a partition table
  In-Reply-To: <BFBB87D2-4AFB-4B2A-A140-E19860849936@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox