You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
141193: Implement types.Any variadic function handling r=mw5h a=mw5h
#### builtins: Change pg_column_size from Immutable to Stable
pg_column_size() is Stable in Postgres, not Immutable.
Epic: none
Release note: none
#### types: reintroduce the 'any' type
In a previous commit, we converted all usages of the old types.Any to
types.AnyElement, which reflects our legacy use of type.Any. This patch
reintroduces types.Any, which is similar to types.AnyElement, but does
not require all instances of types.Any in a function's argument list to
have the same type (i.e. it's a true wildcard).
Future patches will evaluate whether individual uses of types.AnyElement
should really be using types.Any. For reference, types.Any should be
used whenever the type of a expression is truly unconstrained.
Informs: #136295
Release note: None
#### tree: handle builtin overloads with types.Any variadic arguments
Previously, variadic argument lists with types.Any variable arguments
were being processed as types.AnyElement. An earlier patch changed these
instances to types.AnyElement, correcting this error. This patch now
takes the reintroduced types.Any (unconstrained wildcard) and makes it
available for builtin functions. Much of the overload selection process
is constraining untyped arguments to make variadic types.AnyElement
work, so the implementation here is an early special case to avoid that
processing.
Informs: #136295
Release note: None
#### builtins: change concat() to take types.Any arguments
Previously, concat() took a variable argument list of types.AnyElement.
This patch changes the argument type to types.Any and updates some
related tests.
Fixes: #136295
Release note (sql change): concat() no longer requires all arguments
have the same type.
#### builtins: change num_nulls()/num_notnulls() to take types.Any arguments
Previously, num_nulls() and num_notnulls() required all arguments to
have the same type. This patch removes that restriction.
Epic: none
Release note (sql change): num_nulls and num_notnulls() no longer
require all arguments to have the same type.
#### builtins: change format() to accept types.Any arguments
Previously, format() required all arguments after the format string to
have the same argument type. This patch removes that restriction.
Release note (sql change): format() no longer requires all post-format
string arguments to have the same type.
#### builtins: change crdb_internal.datums_to_bytes() to accept types.Any
Previously, crdb_internal.datums_to_bytes() required all arguments to
have the same type. This patch removes that restriction to allow
arguments of any type.
Release note: None
#### builtins: change concat_ws() to accept arguments of types.Any type
Previously, concat_ws() required all arguments to be of type string,
this patch changes the requirement such that the first argument (the
delimiter) must be a string but that all follow-on arguments may be of
any type.
Release note (sql change): concat_ws() now accepts arguments of any type
in the second and later positions (the separator must still be a
string).
#### builtins: change json_build_objects/array() to accept types.Any
Previously, json_build_objects() and json_build_array() (and their
binary variants) required that all arguments have the same type. This
patch removes that requirement so that arguments can be of any type.
Epic: none
Release note (sql change): json_build_objects(), jsonb_build_objects(),
json_build_array(), jsonb_build_array() no longer require that all
arguments have the same type.
#### builtins: change pg_column_size() to accepts arguments of types.Any
Previously, pg_column_size() required that all arguments have the same
type. This patch removes that restriction so that every argument can
have a different type.
Epic: none
Release note (sql change): pg_column_size() no longer requires that all
arguments have the same type.
Co-authored-by: Matt White <[email protected]>
Copy file name to clipboardExpand all lines: docs/generated/sql/functions.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -439,9 +439,9 @@
439
439
</span></td><td>Immutable</td></tr>
440
440
<tr><td><aname="least"></a><code>least(anyelement...) → anyelement</code></td><td><spanclass="funcdesc"><p>Returns the element with the lowest value.</p>
441
441
</span></td><td>Immutable</td></tr>
442
-
<tr><td><aname="num_nonnulls"></a><code>num_nonnulls(anyelement...) → <ahref="int.html">int</a></code></td><td><spanclass="funcdesc"><p>Returns the number of nonnull arguments.</p>
442
+
<tr><td><aname="num_nonnulls"></a><code>num_nonnulls(any...) → <ahref="int.html">int</a></code></td><td><spanclass="funcdesc"><p>Returns the number of nonnull arguments.</p>
443
443
</span></td><td>Immutable</td></tr>
444
-
<tr><td><aname="num_nulls"></a><code>num_nulls(anyelement...) → <ahref="int.html">int</a></code></td><td><spanclass="funcdesc"><p>Returns the number of null arguments.</p>
444
+
<tr><td><aname="num_nulls"></a><code>num_nulls(any...) → <ahref="int.html">int</a></code></td><td><spanclass="funcdesc"><p>Returns the number of null arguments.</p>
445
445
</span></td><td>Immutable</td></tr></tbody>
446
446
</table>
447
447
@@ -1180,9 +1180,9 @@ available replica will error.</p>
1180
1180
</span></td><td>Immutable</td></tr>
1181
1181
<tr><td><aname="json_array_length"></a><code>json_array_length(json: jsonb) → <ahref="int.html">int</a></code></td><td><spanclass="funcdesc"><p>Returns the number of elements in the outermost JSON or JSONB array.</p>
1182
1182
</span></td><td>Immutable</td></tr>
1183
-
<tr><td><aname="json_build_array"></a><code>json_build_array(anyelement...) → jsonb</code></td><td><spanclass="funcdesc"><p>Builds a possibly-heterogeneously-typed JSON or JSONB array out of a variadic argument list.</p>
1183
+
<tr><td><aname="json_build_array"></a><code>json_build_array(any...) → jsonb</code></td><td><spanclass="funcdesc"><p>Builds a possibly-heterogeneously-typed JSON or JSONB array out of a variadic argument list.</p>
1184
1184
</span></td><td>Stable</td></tr>
1185
-
<tr><td><aname="json_build_object"></a><code>json_build_object(anyelement...) → jsonb</code></td><td><spanclass="funcdesc"><p>Builds a JSON object out of a variadic argument list.</p>
1185
+
<tr><td><aname="json_build_object"></a><code>json_build_object(any...) → jsonb</code></td><td><spanclass="funcdesc"><p>Builds a JSON object out of a variadic argument list.</p>
1186
1186
</span></td><td>Stable</td></tr>
1187
1187
<tr><td><aname="json_each"></a><code>json_each(input: jsonb) → tuple{string AS key, jsonb AS value}</code></td><td><spanclass="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs.</p>
1188
1188
</span></td><td>Immutable</td></tr>
@@ -1218,9 +1218,9 @@ available replica will error.</p>
1218
1218
</span></td><td>Immutable</td></tr>
1219
1219
<tr><td><aname="jsonb_array_length"></a><code>jsonb_array_length(json: jsonb) → <ahref="int.html">int</a></code></td><td><spanclass="funcdesc"><p>Returns the number of elements in the outermost JSON or JSONB array.</p>
1220
1220
</span></td><td>Immutable</td></tr>
1221
-
<tr><td><aname="jsonb_build_array"></a><code>jsonb_build_array(anyelement...) → jsonb</code></td><td><spanclass="funcdesc"><p>Builds a possibly-heterogeneously-typed JSON or JSONB array out of a variadic argument list.</p>
1221
+
<tr><td><aname="jsonb_build_array"></a><code>jsonb_build_array(any...) → jsonb</code></td><td><spanclass="funcdesc"><p>Builds a possibly-heterogeneously-typed JSON or JSONB array out of a variadic argument list.</p>
1222
1222
</span></td><td>Stable</td></tr>
1223
-
<tr><td><aname="jsonb_build_object"></a><code>jsonb_build_object(anyelement...) → jsonb</code></td><td><spanclass="funcdesc"><p>Builds a JSON object out of a variadic argument list.</p>
1223
+
<tr><td><aname="jsonb_build_object"></a><code>jsonb_build_object(any...) → jsonb</code></td><td><spanclass="funcdesc"><p>Builds a JSON object out of a variadic argument list.</p>
1224
1224
</span></td><td>Stable</td></tr>
1225
1225
<tr><td><aname="jsonb_each"></a><code>jsonb_each(input: jsonb) → tuple{string AS key, jsonb AS value}</code></td><td><spanclass="funcdesc"><p>Expands the outermost JSON or JSONB object into a set of key/value pairs.</p>
1226
1226
</span></td><td>Immutable</td></tr>
@@ -2912,9 +2912,9 @@ Can be used to define the tile bounds required by ST_AsMVTGeom to convert geomet
2912
2912
</span></td><td>Immutable</td></tr>
2913
2913
<tr><td><aname="compress"></a><code>compress(data: <ahref="bytes.html">bytes</a>, codec: <ahref="string.html">string</a>) → <ahref="bytes.html">bytes</a></code></td><td><spanclass="funcdesc"><p>Compress <code>data</code> with the specified <code>codec</code> (<code>gzip</code>, ‘lz4’, ‘snappy’, 'zstd).</p>
2914
2914
</span></td><td>Immutable</td></tr>
2915
-
<tr><td><aname="concat"></a><code>concat(anyelement...) → <ahref="string.html">string</a></code></td><td><spanclass="funcdesc"><p>Concatenates a comma-separated list of strings.</p>
2915
+
<tr><td><aname="concat"></a><code>concat(any...) → <ahref="string.html">string</a></code></td><td><spanclass="funcdesc"><p>Concatenates a comma-separated list of strings.</p>
2916
2916
</span></td><td>Immutable</td></tr>
2917
-
<tr><td><aname="concat_ws"></a><code>concat_ws(<ahref="string.html">string</a>...) → <ahref="string.html">string</a></code></td><td><spanclass="funcdesc"><p>Uses the first argument as a separator between the concatenation of the subsequent arguments.</p>
2917
+
<tr><td><aname="concat_ws"></a><code>concat_ws(<ahref="string.html">string</a>, any...) → <ahref="string.html">string</a></code></td><td><spanclass="funcdesc"><p>Uses the first argument as a separator between the concatenation of the subsequent arguments.</p>
2918
2918
<p>For example <code>concat_ws('!','wow','great')</code> returns <code>wow!great</code>.</p>
2919
2919
</span></td><td>Immutable</td></tr>
2920
2920
<tr><td><aname="convert_from"></a><code>convert_from(str: <ahref="bytes.html">bytes</a>, enc: <ahref="string.html">string</a>) → <ahref="string.html">string</a></code></td><td><spanclass="funcdesc"><p>Decode the bytes in <code>str</code> into a string using encoding <code>enc</code>. Supports encodings ‘UTF8’ and ‘LATIN1’.</p>
@@ -2929,7 +2929,7 @@ Can be used to define the tile bounds required by ST_AsMVTGeom to convert geomet
<tr><td><aname="format"></a><code>format(<ahref="string.html">string</a>, anyelement...) → <ahref="string.html">string</a></code></td><td><spanclass="funcdesc"><p>Interprets the first argument as a format string similar to C sprintf and interpolates the remaining arguments.</p>
2932
+
<tr><td><aname="format"></a><code>format(<ahref="string.html">string</a>, any...) → <ahref="string.html">string</a></code></td><td><spanclass="funcdesc"><p>Interprets the first argument as a format string similar to C sprintf and interpolates the remaining arguments.</p>
2933
2933
</span></td><td>Stable</td></tr>
2934
2934
<tr><td><aname="from_ip"></a><code>from_ip(val: <ahref="bytes.html">bytes</a>) → <ahref="string.html">string</a></code></td><td><spanclass="funcdesc"><p>Converts the byte string representation of an IP to its character string representation.</p>
2935
2935
</span></td><td>Immutable</td></tr>
@@ -3500,8 +3500,8 @@ may increase either contention or retry errors, or both.</p>
3500
3500
</span></td><td>Stable</td></tr>
3501
3501
<tr><td><aname="pg_column_is_updatable"></a><code>pg_column_is_updatable(reloid: oid, attnum: int2, include_triggers: <ahref="bool.html">bool</a>) → <ahref="bool.html">bool</a></code></td><td><spanclass="funcdesc"><p>Returns whether the given column can be updated.</p>
3502
3502
</span></td><td>Stable</td></tr>
3503
-
<tr><td><aname="pg_column_size"></a><code>pg_column_size(anyelement...) → <ahref="int.html">int</a></code></td><td><spanclass="funcdesc"><p>Return size in bytes of the column provided as an argument</p>
3504
-
</span></td><td>Immutable</td></tr>
3503
+
<tr><td><aname="pg_column_size"></a><code>pg_column_size(any...) → <ahref="int.html">int</a></code></td><td><spanclass="funcdesc"><p>Return size in bytes of the column provided as an argument</p>
3504
+
</span></td><td>Stable</td></tr>
3505
3505
<tr><td><aname="pg_function_is_visible"></a><code>pg_function_is_visible(oid: oid) → <ahref="bool.html">bool</a></code></td><td><spanclass="funcdesc"><p>Returns whether the function with the given OID belongs to one of the schemas on the search path.</p>
3506
3506
</span></td><td>Stable</td></tr>
3507
3507
<tr><td><aname="pg_get_function_arg_default"></a><code>pg_get_function_arg_default(func_oid: oid, arg_num: int4) → <ahref="string.html">string</a></code></td><td><spanclass="funcdesc"><p>Get textual representation of a function argument’s default value. The second argument of this function is the argument number among all arguments (i.e. proallargtypes, <em>not</em> proargtypes), starting with 1, because that’s how information_schema.sql uses it. Currently, this always returns NULL, since CockroachDB does not support default values.</p>
Copy file name to clipboardExpand all lines: pkg/kv/kvserver/replicate_queue_test.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1757,7 +1757,7 @@ func filterRangeLog(
1757
1757
eventType kvserverpb.RangeLogEventType,
1758
1758
reason kvserverpb.RangeLogEventReason,
1759
1759
) ([]kvserverpb.RangeLogEvent_Info, error) {
1760
-
returnqueryRangeLog(conn, `SELECT info FROM system.rangelog WHERE "rangeID" = $1 AND "eventType" = $2 AND info LIKE concat('%', $3, '%') ORDER BY timestamp ASC;`, rangeID, eventType.String(), reason)
1760
+
returnqueryRangeLog(conn, `SELECT info FROM system.rangelog WHERE "rangeID" = $1 AND "eventType" = $2 AND info LIKE concat('%', $3::STRING, '%') ORDER BY timestamp ASC;`, rangeID, eventType.String(), reason)
0 commit comments