Closed onderkalaci closed 9 years ago
@jasonmp85 I had to spend a lot of time on this issue. I had difficulties in creating new composite types which works fine with pg_shard. For documentation purposes, I note what is required for a composite type to work with pg_shard as distribution key:
Hey @jasonmp85 ,
I added a new file for tests. My motivation was to that we have to both create shards and execute queries on that shard. So, putting these tests to create_shards.sql or queries.sql separately didn't fit as good as putting them in a separate file.
What do you think? Is it OK ?
This looks great. Cleaning up and merging.
Hey @jasonmp85 ,
This PR aims to handle how we find the operatorId for the partition columns. Previously, we find operators by directly using the partition column's type. However, it was wrong. We need to find operators by using the partition column's opfamily input type. The reason is that we use "get_opfamily_member()" to get the operators. As it name implies, that function finds the operators for opfamily. So, providing the opclass' input type makes more sense.
With this PR, I tested with different partition columns (distribute table, test INSERT/SELECT/UPDATE):
This fix is based on the changes on CitusDB (Composite type bug). However, there is a difference on the implementation compared to that fix. On CitusDB, we changed "MakeOpExpression" function too. However, that is not needed for us since we already use hashed(integers) values on "MakeOpExpression". But, when we support range partitioning, we may need to add that change too. I thought adding it now, but that would seem very unrelated.
Fixes #80