Skip to content

Commit

Permalink
Merge #65101
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
craig[bot] and MiguelNovelo committed May 13, 2021
2 parents 9279c8f + 83790f6 commit d551b50
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 90 deletions.
36 changes: 18 additions & 18 deletions pkg/sql/logictest/testdata/logic_test/create_statements
Original file line number Diff line number Diff line change
Expand Up @@ -2188,17 +2188,17 @@ CREATE TABLE pg_catalog.pg_constraint (
oid OID NULL,
conname NAME NULL,
connamespace OID NULL,
contype STRING NULL,
contype "char" NULL,
condeferrable BOOL NULL,
condeferred BOOL NULL,
convalidated BOOL NULL,
conrelid OID NOT NULL,
contypid OID NULL,
conindid OID NULL,
confrelid OID NULL,
confupdtype STRING NULL,
confdeltype STRING NULL,
confmatchtype STRING NULL,
confupdtype "char" NULL,
confdeltype "char" NULL,
confmatchtype "char" NULL,
conislocal BOOL NULL,
coninhcount INT4 NULL,
connoinherit BOOL NULL,
Expand All @@ -2217,17 +2217,17 @@ CREATE TABLE pg_catalog.pg_constraint (
oid OID NULL,
conname NAME NULL,
connamespace OID NULL,
contype STRING NULL,
contype "char" NULL,
condeferrable BOOL NULL,
condeferred BOOL NULL,
convalidated BOOL NULL,
conrelid OID NOT NULL,
contypid OID NULL,
conindid OID NULL,
confrelid OID NULL,
confupdtype STRING NULL,
confdeltype STRING NULL,
confmatchtype STRING NULL,
confupdtype "char" NULL,
confdeltype "char" NULL,
confmatchtype "char" NULL,
conislocal BOOL NULL,
coninhcount INT4 NULL,
connoinherit BOOL NULL,
Expand Down Expand Up @@ -2703,7 +2703,7 @@ CREATE TABLE pg_catalog.pg_operator (
oprname NAME NULL,
oprnamespace OID NULL,
oprowner OID NULL,
oprkind STRING NULL,
oprkind "char" NULL,
oprcanmerge BOOL NULL,
oprcanhash BOOL NULL,
oprleft OID NULL,
Expand All @@ -2719,7 +2719,7 @@ CREATE TABLE pg_catalog.pg_operator (
oprname NAME NULL,
oprnamespace OID NULL,
oprowner OID NULL,
oprkind STRING NULL,
oprkind "char" NULL,
oprcanmerge BOOL NULL,
oprcanhash BOOL NULL,
oprleft OID NULL,
Expand Down Expand Up @@ -2850,7 +2850,7 @@ CREATE TABLE pg_catalog.pg_proc (
prorettype OID NULL,
proargtypes OIDVECTOR NULL,
proallargtypes OID[] NULL,
proargmodes STRING[] NULL,
proargmodes "char"[] NULL,
proargnames STRING[] NULL,
proargdefaults STRING NULL,
protrftypes OID[] NULL,
Expand Down Expand Up @@ -2883,7 +2883,7 @@ CREATE TABLE pg_catalog.pg_proc (
prorettype OID NULL,
proargtypes OIDVECTOR NULL,
proallargtypes OID[] NULL,
proargmodes STRING[] NULL,
proargmodes "char"[] NULL,
proargnames STRING[] NULL,
proargdefaults STRING NULL,
protrftypes OID[] NULL,
Expand Down Expand Up @@ -3001,17 +3001,17 @@ CREATE TABLE pg_catalog.pg_rewrite (
oid OID NULL,
rulename NAME NULL,
ev_class OID NULL,
ev_type STRING NULL,
ev_enabled STRING NULL,
ev_type "char" NULL,
ev_enabled "char" NULL,
is_instead BOOL NULL,
ev_qual STRING NULL,
ev_action STRING NULL
) CREATE TABLE pg_catalog.pg_rewrite (
oid OID NULL,
rulename NAME NULL,
ev_class OID NULL,
ev_type STRING NULL,
ev_enabled STRING NULL,
ev_type "char" NULL,
ev_enabled "char" NULL,
is_instead BOOL NULL,
ev_qual STRING NULL,
ev_action STRING NULL
Expand Down Expand Up @@ -3409,7 +3409,7 @@ CREATE TABLE pg_catalog.pg_trigger (
tgname NAME NULL,
tgfoid OID NULL,
tgtype INT2 NULL,
tgenabled STRING NULL,
tgenabled "char" NULL,
tgisinternal BOOL NULL,
tgconstrrelid OID NULL,
tgconstrindid OID NULL,
Expand All @@ -3429,7 +3429,7 @@ CREATE TABLE pg_catalog.pg_trigger (
tgname NAME NULL,
tgfoid OID NULL,
tgtype INT2 NULL,
tgenabled STRING NULL,
tgenabled "char" NULL,
tgisinternal BOOL NULL,
tgconstrrelid OID NULL,
tgconstrindid OID NULL,
Expand Down
64 changes: 1 addition & 63 deletions pkg/sql/testdata/pg_catalog_test_expected_diffs.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,6 @@
"expectedDataType": "name"
}
},
"pg_constraint": {
"confdeltype": {
"oid": 25,
"dataType": "text",
"expectedOid": 18,
"expectedDataType": "char"
},
"confmatchtype": {
"oid": 25,
"dataType": "text",
"expectedOid": 18,
"expectedDataType": "char"
},
"confupdtype": {
"oid": 25,
"dataType": "text",
"expectedOid": 18,
"expectedDataType": "char"
},
"contype": {
"oid": 25,
"dataType": "text",
"expectedOid": 18,
"expectedDataType": "char"
}
},
"pg_conversion": {
"conproc": {
"oid": 26,
Expand Down Expand Up @@ -113,27 +87,13 @@
"expectedOid": 24,
"expectedDataType": "regproc"
},
"oprkind": {
"oid": 25,
"dataType": "text",
"expectedOid": 18,
"expectedDataType": "char"
},
"oprrest": {
"oid": 26,
"dataType": "oid",
"expectedOid": 24,
"expectedDataType": "regproc"
}
},
"pg_proc": {
"proargmodes": {
"oid": 1009,
"dataType": "_text",
"expectedOid": 1002,
"expectedDataType": "_char"
}
},
"pg_range": {
"rngcanonical": {
"oid": 26,
Expand All @@ -148,20 +108,6 @@
"expectedDataType": "regproc"
}
},
"pg_rewrite": {
"ev_enabled": {
"oid": 25,
"dataType": "text",
"expectedOid": 18,
"expectedDataType": "char"
},
"ev_type": {
"oid": 25,
"dataType": "text",
"expectedOid": 18,
"expectedDataType": "char"
}
},
"pg_seclabel": {
"objsubid": {
"oid": 20,
Expand All @@ -178,14 +124,6 @@
"expectedDataType": "_text"
}
},
"pg_trigger": {
"tgenabled": {
"oid": 25,
"dataType": "text",
"expectedOid": 18,
"expectedDataType": "char"
}
},
"pg_user": {
"valuntil": {
"oid": 1114,
Expand All @@ -194,4 +132,4 @@
"expectedDataType": "timestamptz"
}
}
}
}
18 changes: 9 additions & 9 deletions pkg/sql/vtable/pg_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,17 @@ CREATE TABLE pg_catalog.pg_constraint (
oid OID,
conname NAME,
connamespace OID,
contype STRING,
contype "char",
condeferrable BOOL,
condeferred BOOL,
convalidated BOOL,
conrelid OID NOT NULL,
contypid OID,
conindid OID,
confrelid OID,
confupdtype STRING,
confdeltype STRING,
confmatchtype STRING,
confupdtype "char",
confdeltype "char",
confmatchtype "char",
conislocal BOOL,
coninhcount INT4,
connoinherit BOOL,
Expand Down Expand Up @@ -533,7 +533,7 @@ CREATE TABLE pg_catalog.pg_operator (
oprname NAME,
oprnamespace OID,
oprowner OID,
oprkind TEXT,
oprkind "char",
oprcanmerge BOOL,
oprcanhash BOOL,
oprleft OID,
Expand Down Expand Up @@ -600,7 +600,7 @@ CREATE TABLE pg_catalog.pg_proc (
prorettype OID,
proargtypes OIDVECTOR,
proallargtypes OID[],
proargmodes STRING[],
proargmodes "char"[],
proargnames STRING[],
proargdefaults STRING,
protrftypes OID[],
Expand Down Expand Up @@ -631,8 +631,8 @@ CREATE TABLE pg_catalog.pg_rewrite (
oid OID,
rulename NAME,
ev_class OID,
ev_type TEXT,
ev_enabled TEXT,
ev_type "char",
ev_enabled "char",
is_instead BOOL,
ev_qual TEXT,
ev_action TEXT
Expand Down Expand Up @@ -758,7 +758,7 @@ CREATE TABLE pg_catalog.pg_trigger (
tgname NAME,
tgfoid OID,
tgtype INT2,
tgenabled TEXT,
tgenabled "char",
tgisinternal BOOL,
tgconstrrelid OID,
tgconstrindid OID,
Expand Down

0 comments on commit d551b50

Please sign in to comment.