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

cast: set volatility of casts to/from TEXT and NAME to leak-proof #81783

Merged
merged 1 commit into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/sql/sem/cast/cast_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{
},
oid.T_name: {
oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable},
oid.T_text: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable},
oid.T_text: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.LeakProof},
oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable},
// Automatic I/O conversions to string types.
oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable},
Expand Down Expand Up @@ -720,7 +720,7 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{
oid.T_bpchar: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable},
oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable},
oidext.T_geometry: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable},
oid.T_name: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable},
oid.T_name: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.LeakProof},
oid.T_regclass: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Stable},
// We include a TEXT->TEXT entry to mimic the VARCHAR->VARCHAR entry
// that is included in the pg_cast table. Postgres doesn't include a
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/sem/cast/testdata/pg_cast_dump.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ castsource|casttarget|provolatile|proleakproof|castcontext|pg_version
18|25|i|f|i|13.5
18|1042|i|f|a|13.5
18|1043|i|f|a|13.5
19|25|i|f|i|13.5
19|25|i|t|i|14.2
19|1042|i|f|a|13.5
19|1043|i|f|a|13.5
20|21|i|f|a|13.5
Expand Down Expand Up @@ -57,7 +57,7 @@ castsource|casttarget|provolatile|proleakproof|castcontext|pg_version
23|1700|i|f|i|13.5
24|20|i|f|a|13.5
25|18|i|f|a|13.5
25|19|i|f|i|13.5
25|19|i|t|i|14.2
25|142|s|f|e|13.5
25|2205|s|f|i|13.5
26|20|i|f|a|13.5
Expand Down