Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6X] Also set dependent array type encoding on ALTER TYPE ENCODING #14883

Conversation

kyeap-vmware
Copy link
Contributor

@kyeap-vmware kyeap-vmware commented Jan 31, 2023

This is a backport of main commit:
670ffac

An exception was added to the original commit to allow changing domain
type default encodings without needing a dependent array type because
dependent array types for domains are present on 7x but not 6x.

Original commit message:
Changing a type's default encoding using ALTER TYPE name SET DEFAULT
ENCODING should also set it's dependent array type to the same encoding.
This is the expected behavior when default compression encoding is
specified on CREATE TYPE. This also fixes pg_dump and pg_upgrade since
pg_dump relies on ALTER TYPE statements to set a type's default
encoding.

Without this change user defined types with their default encodings
specified on CREATE TYPE will set default encodings on the both the type
and it's depedent array type. The ALTER TYPE SET DEFAULT ENCODING
statement from pg_dump would not restore the default encoding of the
dependent array type.

This change prohibits altering types without a dependent array type.
This was allowed under the following assumptions.

  1. User defined types will always have dependent array types
  2. It is fine that this prohibits some internal types with no dependent
    array types from having their default encodings modified.
  3. Forcing types and their dependent array to restore with the same
    default encoding will not break existing tables because columns store
    their own encoding.

While this means some internal types now cannot have their default
encodings changed, we will keep the default encodings of user defined
types and it's dependent array type in sync.

pipeline: https://cm.ci.gpdb.pivotal.io/teams/main/pipelines/6x-alter-encode

@kyeap-vmware kyeap-vmware changed the title Also set dependent array type encoding on ALTER TYPE ENCODING [6X] Also set dependent array type encoding on ALTER TYPE ENCODING Jan 31, 2023
@kyeap-vmware kyeap-vmware force-pushed the 6x-alter-dependent-type-encoding branch 2 times, most recently from 2781a51 to 5b3c2ea Compare February 3, 2023 21:11
This is a backport of main commit:
greenplum-db@670ffac

An exception was added to the original commit to allow changing domain
type default encodings without needing a dependent array type because
dependent array types for domains are present on 7x but not 6x.

Original commit message:
Changing a type's default encoding using ALTER TYPE name SET DEFAULT
ENCODING should also set it's dependent array type to the same encoding.
This is the expected behavior when default compression encoding is
specified on CREATE TYPE. This also fixes pg_dump and pg_upgrade since
pg_dump relies on ALTER TYPE statements to set a type's default
encoding.

Without this change user defined types with their default encodings
specified on CREATE TYPE will set default encodings on the both the type
and it's depedent array type. The ALTER TYPE SET DEFAULT ENCODING
statement from pg_dump would not restore the default encoding of the
dependent array type.

This change prohibits altering types without a dependent array type.
This was allowed under the following assumptions.
1. User defined types will always have dependent array types
2. It is fine that this prohibits some internal types with no dependent
   array types from having their default encodings modified.
3. Forcing types and their dependent array to restore with the same
   default encoding will not break existing tables because columns store
   their own encoding.

While this means some internal types now cannot have their default
encodings changed, we will keep the default encodings of user defined
types and it's dependent array type in sync.
@kyeap-vmware kyeap-vmware force-pushed the 6x-alter-dependent-type-encoding branch from 5b3c2ea to 1aa88dc Compare February 8, 2023 22:55
@kyeap-vmware kyeap-vmware merged commit f1cf463 into greenplum-db:6X_STABLE Feb 25, 2023
@kyeap-vmware kyeap-vmware deleted the 6x-alter-dependent-type-encoding branch February 25, 2023 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants