-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
sql: populate the pg_enum catalog table #49213
Conversation
Look at the second commit please! I did the oid generation with hashing -- I think it's fine for this table. A reasonable index would be on |
// internally using floats for ordering like Postgres, so just pick a | ||
// float entry for the rows. | ||
typ := types.MakeEnum(uint32(typDesc.ID)) | ||
if err := typDesc.HydrateTypeInfo(typ); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stay hydrated!
(why didn't we call this InitTypeInfo
? hah.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK, someone said Hydrate once and then I couldn't get it out of my head
typOID := tree.NewDOid(tree.DInt(typ.Oid())) | ||
for i := range enumData.LogicalRepresentations { | ||
if err := addRow( | ||
h.EnumEntryOid(typOID, enumData.PhysicalRepresentations[i]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this change every time the ENUM changes? if so that seems bad.
can we use some sort of other unique identifier? typDesc.ID
seems better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the physical representations are static. Either way, IDT we could do typDesc.ID because each row here needs a new OID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right, i totally missed that this is happening on each logical repr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if physical repr stay the same, LGTM!
Fixes cockroachdb#48359. Release note (sql change): Populate the catalog table `pg_catalog.pg_enum`.
TFTR bors r+ |
Build succeeded |
Fixes #48359.
Release note (sql change): Populate the catalog table
pg_catalog.pg_enum
.