@@ -28,6 +28,7 @@ mechanisms that Diffix Elm uses to protect personal data.
2828 - [ width_bucket(operand, low, high, count)`] ( #width_bucketoperand-low-high-count )
2929 - [ String generalization functions] ( #string-generalization-functions )
3030 - [ substring(text_column, start, count)] ( #substringtext_column-start-count )
31+ - [ Type casts] ( #type-casts )
3132 - [ Utility functions] ( #utility-functions )
3233 - [ diffix.is_suppress_bin(* )] ( #diffixis_suppress_bin )
3334
@@ -235,6 +236,27 @@ Default [Postgres function](https://www.postgresql.org/docs/14/functions-string.
235236
236237** Restrictions:** In untrusted mode, only ` start = 1 ` is allowed.
237238
239+ ## Type casts
240+
241+ When selecting or generalizing columns of personal tables, the following type conversions are allowed:
242+
243+ - All numeric types may be converted to other numeric types.
244+ Numeric types are: ` smallint ` , ` integer ` , ` bigint ` , ` float ` , ` double ` , and ` numeric ` (` decimal ` ).
245+ When converting from a real type to an integer type, implicit rounding occurs (away from zero).
246+ Such casts count as generalizing expressions and no further generalizations are allowed.
247+ - Date/time types may be converted to text.
248+ Date/time types are: ` date ` , ` time ` , ` timestamp ` , ` timetz ` , and ` timestamptz ` .
249+ The [ DateStyle] ( https://www.postgresql.org/docs/14/runtime-config-client.html#GUC-DATESTYLE )
250+ configuration parameter determines the output format of the string.
251+
252+ ** Example:**
253+
254+ ```
255+ SELECT substring(date_of_birth::text, 1, 4) AS year, count(*)
256+ FROM customers
257+ GROUP BY 1
258+ ```
259+
238260## Utility functions
239261
240262### diffix.is_suppress_bin(* )
0 commit comments