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: incorrect types for some pg_constraint columns #64434

Closed
arulajmani opened this issue Apr 29, 2021 · 1 comment · Fixed by #65101
Closed

sql: incorrect types for some pg_constraint columns #64434

arulajmani opened this issue Apr 29, 2021 · 1 comment · Fixed by #65101
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL A-tools-prisma C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@arulajmani
Copy link
Collaborator

arulajmani commented Apr 29, 2021

Describe the problem

As per the pg_constraint schema here: https://www.postgresql.org/docs/current/catalog-pg-constraint.html, a few of the columns seem to have an incorrect data type. For example, columns such as confdeltype and confuptypeand are represented as strings in CRDB, but are single char columns in Postgres. We should match our schema to Postgres.

@arulajmani arulajmani added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-sql-pgcompat Semantic compatibility with PostgreSQL A-tools-prisma labels Apr 29, 2021
@rafiss rafiss added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label May 6, 2021
@rafiss
Copy link
Collaborator

rafiss commented May 7, 2021

Let's go through all the diffs in pg_catalog_test_expected_diffs.json and fix the columns that have a diff like this:

{
      "oid": 25,
      "dataType": "text",
      "expectedOid": 18,
      "expectedDataType": "char"
}

there's only 8 of them, so we can do the change manually. @mnovelodou could you get to this when you have a chance?

craig bot pushed a commit that referenced this issue May 13, 2021
65101: sql: changed pg_catalog data type columns to "char" to match postgres r=arulajmani a=mnovelodou

Previously, some columns where is expected "char" datatype
it is created as TEXT
This was inadequate because some tools are expecting these
columns to have "char" datatype
To address this, this patch change the data types from these
columns

Release note (backward-incompatible change): Switched types from TEXT
to "char" for compatibility with postgres in the following columns:

pg_constraint (confdeltype, confmatchtype, confudptype, contype)
pg_operator (oprkind)
pg_prog (proargmodes)
pg_rewrite (ev_enabled, ev_type)
pg_trigger (tgenabled)

Fixes #64434

Co-authored-by: MiguelNovelo <[email protected]>
@craig craig bot closed this as completed in 83790f6 May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL A-tools-prisma C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants