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

sql: allow INT to compare to OID #53523

Merged
merged 1 commit into from
Aug 27, 2020
Merged

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Aug 26, 2020

An OID is just an INT, so they should be comparable.

Postgres allows this, and certain drivers create queries that attempt to
compare INTs to OIDs, so this improves compatibility.

fixes #53143

Release justification: low-risk, high benefit change that improves
compatibility with PGJDBC.
Release note (sql change): A value of type OID can now be compared to a
value of type INT.

An OID is just an INT, so they should be comparable.

Postgres allows this, and certain drivers create queries that attempt to
compare INTs to OIDs, so this improves compatibility.

Release justification: low-risk, high benefit change that improves
compatibility with PGJDBC.
Release note (sql change): A value of type OID can now be compared to a
value of type INT.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@jordanlewis jordanlewis left a comment

Choose a reason for hiding this comment

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

:lgtm: that was easier than i expected! Implicit casts I think would remove the necessity for this, but we're not there yet so I think this is a good idea. (for the record, postgres uses implicit casts for this only, and doesn't have true cross-type operators for oid/int, but not sure it really matters)

jordan=# select oprleft::regtype, oprright::regtype from pg_operator where oprleft='oid'::regtype::oid;
 oprleft | oprright
---------+----------
 oid     | oid
 oid     | oid
 oid     | oid
 oid     | oid
 oid     | oid
 oid     | oid
(6 rows)

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis and @solongordon)

@rafiss
Copy link
Collaborator Author

rafiss commented Aug 27, 2020

thanks for reviewing!

bors r=jordanlewis

@craig
Copy link
Contributor

craig bot commented Aug 27, 2020

Build succeeded:

@craig craig bot merged commit 1f1ac2e into cockroachdb:master Aug 27, 2020
@rafiss rafiss deleted the int-oid-cmp branch August 27, 2020 15:40
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.

sql: pgjdbc PgResultSetMetaData.fetchFieldMetaData fails with unsupported comparison operator: <oid> = <int>
3 participants