
(Resending; group conversation via google groups didn’t make it to mail. 2nd
attempt to send via mail)
Hello Folks,
Context:
Recently we came across an issue in GP6 where the partition key was dropped by using `DROP TYPE .. CASCADE` on a user defined type that was associated with that partition key. Later when a select query was executed on this table it caused a crash with ORCA.
A direct drop on the partition key column is not allowed in GP6 or GP7.
This led to looking into if there are any other behavioral differences between
direct drop (`ALTER TABLE .... DROP COLUMN`) and `DROP TYPE.. CASCADE` on GP6 and GP7 that would leave the table in a state where queries may cause other issues.
Below is a matrix of scenarios tried :

Wanted to understand better if there is a reason we have these differences in behavior? Or if they were not intended, then how would we want to proceed moving forward?
(Resending; group conversation via google groups didn’t make it to mail. 2nd attempt to send via mail)
Hello Folks,
Context:Recently we came across an issue in GP6 where the partition key was dropped by using `DROP TYPE .. CASCADE` on a user defined type that was associated with that partition key. Later when a select query was executed on this table it caused a crash with ORCA.
A direct drop on the partition key column is not allowed in GP6 or GP7.
This led to looking into if there are any other behavioral differences between direct drop (`ALTER TABLE .... DROP COLUMN`) and `DROP TYPE.. CASCADE` on GP6 and GP7 that would leave the table in a state where queries may cause other issues.
Below is a matrix of scenarios tried :
Wanted to understand better if there is a reason we have these differences in behavior? Or if they were not intended, then how would we want to proceed moving forward?
Below are some initial proposals for closing the gaps:
1. For partition key column: GP6 should also drop the table altogether and be consistent with GP7 and Postgres, but not sure how that would impact current GP6 users.
Another way for GP6 would be to disallow dropping partition key columns completely and error out during DROP TYPE .. CASCADE (same behavior as direct drop on partition key COLUMN).
2. For distribution key column: this should be the same behavior as direct drop on distribution column,i.e, drop the column and set distribution policy as randomly distributed.
Below are some initial proposals for closing the gaps:
1. For partition key column: GP6 should also drop the table altogether and be consistent with GP7 and Postgres, but not sure how that would impact current GP6 users.
Another way for GP6 would be to disallow dropping partition key columns completely and error out during DROP TYPE .. CASCADE (same behavior as direct drop on partition key COLUMN).
Dropping the table does feel like a very drastic step (specially for
STABLE release if any logic error happens to correctly detect the
condition may end up deleting tables which shouldn't have been
dropped). Hence, I feel we should be conservative at changing the
behavior and just fail DROP TYPE..CASCADE and let users take the
action (which also gives them a chance to backup data and such if
required).
Also, one dangling part remains when mail says it works fine for the
planner after this condition. What exactly does fine mean? How does
insert behavior with dropped partition key? How does partition
elimination work with dropped partition key? Does planner have
explicit or special logic coded to handle all such cases or is
working by accident?
|
!! External Email
|
|
!! External Email: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender.
|
Another scenario: for a table with default partition and dropped partition key
Updated matrix below:

--
To unsubscribe from this topic, visit
https://groups.google.com/a/greenplum.org/d/topic/gpdb-dev/Yo2Tp18ENu8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
gpdb-dev+u...@greenplum.org.