jobinau / pg_partmaint Goto Github PK
View Code? Open in Web Editor NEWSuper Simple partition maintenance automation for PostgreSQL
Super Simple partition maintenance automation for PostgreSQL
Thanks to @gianmh for reporting the problem.
Create the first partition
CREATE TABLE public.tab1_p0 PARTITION OF public.tab1 FOR VALUES FROM ('0') TO ('500000');
Then generate the new partitions.
./pg_partmaint.py -c "" -t public.tab1 -i 5000000 -p 40 --display
The output generated for newly created partition will contain the same partition again
CREATE TABLE public.tab1_p0 PARTITION OF public.tab1 FOR VALUES FROM ('0') TO ('5000000')
CREATE TABLE public.tab1_p5000000 PARTITION OF public.tab1 FOR VALUES FROM ('5000000') TO ('10000000')
CREATE TABLE public.tab1_p10000000 PARTITION OF public.tab1 FOR VALUES FROM ('10000000') TO ('15000000')
CREATE TABLE public.tab1_p15000000 PARTITION OF public.tab1 FOR VALUES FROM ('15000000') TO ('20000000')
Partition tables with default partitions are reported to be failing.
CREATE TABLE emp (id int,
dob timestamp(6) without time zone
)
PARTITION BY RANGE (dob);
CREATE TABLE public."emp_2019-01-01_2020-11-30" PARTITION OF emp FOR VALUES FROM ('2019-01-01 00:00:00') TO ('2020-11-30 00:00:00');
CREATE TABLE public."emp_2020-11-30_2020-12-01" PARTITION OF emp FOR VALUES FROM ('2020-11-30 00:00:00') TO ('2020-12-01 00:00:00');
CREATE TABLE public."emp_2020-12-01_2020-12-02" PARTITION OF emp FOR VALUES FROM ('2020-12-01 00:00:00') TO ('2020-12-02 00:00:00');
CREATE TABLE public.emp_default PARTITION OF emp DEFAULT;
./pg_partmaint.py -c "" -t public.emp -i weekly -p 5 --displayddl
Version: 3.1
Connecting to Databse...
Verified that table : public.emp is a partitioned table
Current Number of Free Partitions in the table :4
Preparing 1 more new partition(s)
Traceback (most recent call last):
File "./pg_partmaint.py", line 188, in <module>
tab1.prepareNewPartitions(int(args.premake)-freeParts)
File "./pg_partmaint.py", line 121, in prepareNewPartitions
cur.execute(sql)
File "/usr/local/lib/python2.7/dist-packages/psycopg2/extras.py", line 243, in execute
return super(RealDictCursor, self).execute(query, vars)
psycopg2.errors.InvalidDatetimeFormat: invalid input syntax for type date: "ULT"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.