Oracle to Postgres - Transform Hash Partition

From: David Barbour <dbarbour(at)istation(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Oracle to Postgres - Transform Hash Partition
Date: 2024-06-06 16:28:20
Message-ID: CAEMHB2R1VA09f22WbBOJz5YE6WLC7aK7HYwo7UXSWdyqN5bmpw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

New to this list and to Postgres. Been an Oracle DBA for quite a while and
we're moving from Oracle to Postgres.

I have a table that I need to transform into a hash partitioned table.
I've gone through all the steps to create a hash partitioned table, with 8
partitions such as

create table idev.assessment_result_2023_dab_part (like
idev.assessment_result_2023_dab)partition by hash (district_oid);

CREATE TABLE idev.assessment_result_2023_dab_part_assessment_result_2023_p1
PARTITION OF idev.assessment_result_2023_dab_part
FOR VALUES WITH (modulus 64, remainder 0)

....etc through partition 2023_p8 FOR VALUES WITH (modulus 64, remainder 7)

Now I need to 'attach' the original table. The problem I'm running into is
there are no good examples of how to define the values.

I've tried several iterations of various 'for values', 'values', 'for
values with', etc. but they all error out.

Here's an example:
alter table idev.assessment_result_2023_dab_part
attach partition idev.assessment_result_2023_dab for values with(modulus 8,
remainder 1) to (modulus 8, remainder 7)

ERROR: syntax error at or near "to" LINE 2: ..._2023_dab for values
with(modulus 8, remainder 1) to (modulu...

Any assistance would be appreciated.
--

*David A. Barbour*

*dbarbour(at)istation(dot)com <dbarbour(at)istation(dot)com>*

*(214) 292-4096*

Istation

8150 North Central Expressway, Suite 2000

Dallas, TX 75206

www.Istation.com <http://www.istation.com/>

CONFIDENTIALITY / PROPRIETARY NOTICE:

The information contained in this e-mail, including any attachment(s), is
confidential information that may be privileged and exempt from disclosure
under applicable law. If the reader of this message is not the intended
recipient, or if you received this message in error, then any direct or
indirect disclosure, distribution or copying of this message is strictly
prohibited. If you have received this message in error, please notify
Istation by calling 866-883-7323 immediately and by sending a return
e-mail; delete this message; and destroy all copies, including attachments.

Thank you.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Avi Weinberg 2024-06-06 16:38:39 Tables get stuck at srsubstate = f
Previous Message Ron Johnson 2024-06-06 16:25:38 Re: Logical replication type- WAL recovery fails and changes the size of wal segment in archivedir