On Thu, Nov 17, 2016 at 8:18 PM, Amit Langote <langote_amit...@lab.ntt.co.jp> wrote: > The reason NULLs in an input row are caught and rejected (with the current > message) before control reaches range_partition_for_tuple() is because > it's not clear to me whether the range bound comparison logic in > partition_rbound_datum_cmp() should be prepared to handle NULLs and what > the results of comparisons should look like. Currently, all it ever > expects to see in the input tuple's partition key is non-NULL datums. > Comparison proceeds as follows: if a range bound datum is a finite value, > we invoke the comparison proc or if it is infinite, we conclude that the > input tuple is > or < the bound in question based on whether the bound is > a lower or upper bound, respectively. > > Or are you saying that get_tuple_for_partition() should simply return -1 > (partition not found) in case of encountering a NULL in range partition > key to the caller instead of throwing error as is now? If the user sees > the message and decides to create a new range partition that *will* accept > such a row, how do they decide what its boundaries should be?
Well, I think the first thing you have to decide is whether range partitioning is going to support NULL values in the partition key columns at all. If you want it to support that, then you've got to decide how it's going to be specified in the SQL syntax. I had the impression that you were planning not to support that, in which case you need to reject all such rows. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers