Giter Club home page Giter Club logo

pg_partmaint's People

Contributors

gianmh avatar jobinau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pg_partmaint's Issues

Partition tables with default partitions are failing

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"

First range is repeating for the generated partition.

Thanks to @gianmh for reporting the problem.

Problem Reproduction step

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')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.