• Dean Rasheed's avatar
    Simplify the logic checking new range partition bounds. · c03911d9
    Dean Rasheed authored
    The previous logic, whilst not actually wrong, was overly complex and
    involved doing two binary searches, where only one was really
    necessary. This simplifies that logic and improves the comments.
    
    One visible change is that if the new partition overlaps multiple
    existing partitions, the error message now always reports the overlap
    with the first existing partition (the one with the lowest
    bounds). The old code would sometimes report the clash with the first
    partition and sometimes with the last one.
    
    Original patch idea from Amit Langote, substantially rewritten by me.
    
    Discussion: https://postgr.es/m/CAAJ_b947mowpLdxL3jo3YLKngRjrq9+Ej4ymduQTfYR+8=YAYQ@mail.gmail.com
    c03911d9
create_table.out 30 KB