Skip to content

Commit

Permalink
Merge pull request #137941 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-24.3-137928

release-24.3: sql: remove NULL values from REGPROC columns of pg_catalog.pg_type
  • Loading branch information
mgartner authored Dec 23, 2024
2 parents 4345c16 + 7d1226d commit 427eba8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/logictest/testdata/logic_test/pg_catalog
Original file line number Diff line number Diff line change
Expand Up @@ -2167,7 +2167,7 @@ oid typname typinput typoutput typreceive
2249 record record_in record_out record_recv record_send 0 0 0
2277 anyarray anyarray_in anyarray_out anyarray_recv anyarray_send 0 0 0
2278 void voidin voidout voidrecv voidsend 0 0 0
2279 trigger NULL NULL NULL NULL 0 0 0
2279 trigger - - - - 0 0 0
2283 anyelement anyelement_in anyelement_out anyelement_recv anyelement_send 0 0 0
2287 _record array_in array_out array_recv array_send 0 0 0
2950 uuid uuid_in uuid_out uuid_recv uuid_send 0 0 0
Expand Down
48 changes: 24 additions & 24 deletions pkg/sql/pg_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ import (
)

var (
oidZero = tree.NewDOid(0)
zeroVal = tree.DZero
negOneVal = tree.NewDInt(-1)
oidZero = tree.NewDOid(0)
regProcOidZero = tree.NewDOidWithTypeAndName(0, types.RegProc, "-")
zeroVal = tree.DZero
negOneVal = tree.NewDInt(-1)

passwdStarString = tree.NewDString("********")
)
Expand Down Expand Up @@ -4882,28 +4883,27 @@ https://www.postgresql.org/docs/9.6/catalog-pg-aggregate.html`,
}
}
}
regprocForZeroOid := tree.NewDOidWithTypeAndName(0, types.RegProc, "-")
err := addRow(
tree.NewDOid(overload.Oid).AsRegProc(name), // aggfnoid
aggregateKind, // aggkind
aggNumDirectArgs, // aggnumdirectargs
regprocForZeroOid, // aggtransfn
regprocForZeroOid, // aggfinalfn
regprocForZeroOid, // aggcombinefn
regprocForZeroOid, // aggserialfn
regprocForZeroOid, // aggdeserialfn
regprocForZeroOid, // aggmtransfn
regprocForZeroOid, // aggminvtransfn
regprocForZeroOid, // aggmfinalfn
tree.DBoolFalse, // aggfinalextra
tree.DBoolFalse, // aggmfinalextra
sortOperatorOid, // aggsortop
tree.DNull, // aggtranstype
tree.DNull, // aggtransspace
tree.DNull, // aggmtranstype
tree.DNull, // aggmtransspace
tree.DNull, // agginitval
tree.DNull, // aggminitval
aggregateKind, // aggkind
aggNumDirectArgs, // aggnumdirectargs
regProcOidZero, // aggtransfn
regProcOidZero, // aggfinalfn
regProcOidZero, // aggcombinefn
regProcOidZero, // aggserialfn
regProcOidZero, // aggdeserialfn
regProcOidZero, // aggmtransfn
regProcOidZero, // aggminvtransfn
regProcOidZero, // aggmfinalfn
tree.DBoolFalse, // aggfinalextra
tree.DBoolFalse, // aggmfinalextra
sortOperatorOid, // aggsortop
tree.DNull, // aggtranstype
tree.DNull, // aggtransspace
tree.DNull, // aggmtranstype
tree.DNull, // aggmtransspace
tree.DNull, // agginitval
tree.DNull, // aggminitval
// These columns were automatically created by pg_catalog_test's missing column generator.
tree.DNull, // aggfinalmodify
tree.DNull, // aggmfinalmodify
Expand Down Expand Up @@ -5128,7 +5128,7 @@ func (h oidHasher) UniqueConstraintOid(
func (h oidHasher) RegProc(name string) tree.Datum {
_, overloads := builtinsregistry.GetBuiltinProperties(name)
if len(overloads) == 0 {
return tree.DNull
return regProcOidZero
}
return tree.NewDOid(overloads[0].Oid).AsRegProc(name)
}
Expand Down

0 comments on commit 427eba8

Please sign in to comment.