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

registering UUID Arrays #236

Merged
merged 1 commit into from
Oct 26, 2021
Merged

registering UUID Arrays #236

merged 1 commit into from
Oct 26, 2021

Conversation

jwoertink
Copy link
Contributor

This fixes a bug when getting the value of a Array(UUID) from postgres giving you Bytes instead of Array(PG::UUIDArray).

It seems when I added #225 I forgot this extra bit 😬 oops!

@@ -173,4 +173,5 @@ module PG
array_type String, 1009
array_type Numeric, 1231
array_type Time, [1115, 1182]
array_type UUID, 2951
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this from a table that had a uuid[] type using SELECT * FROM pg_attribute WHERE attrelid = 'buckets'::regclass;

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. You could also get it with

will=# select pg_typeof(array[gen_random_uuid()]);
 pg_typeof
-----------
 uuid[]
(1 row)

Time: 0.367 ms
will=# select pg_typeof(array[gen_random_uuid()])::oid;
 pg_typeof
-----------
      2951
(1 row)

Time: 0.21

or checking out this file https://github.com/postgres/postgres/blob/14472442861ca95cc9158518acdedf740c4bff55/src/include/catalog/pg_type.dat#L402

The latter is good to make sure that some of these less-oftenly-seen types have stable OIDs, vs ones that may come from extensions which can change, even if that extension comes with postgres. Still need to do something about those eventually.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh nice! That's good to know. Thanks 😄

@will will merged commit 44d0ff2 into will:master Oct 26, 2021
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

2 participants