Returns an iterator over configuration parameters (and their current values for this session) that are expected to be sent to the client when a new connection is established or when their value changes.
(&self)
| 484 | /// values for this session) that are expected to be sent to the client when |
| 485 | /// a new connection is established or when their value changes. |
| 486 | pub fn notify_set(&self) -> impl Iterator<Item = &dyn Var> { |
| 487 | // WARNING: variables in this set are not checked for visibility, and |
| 488 | // are assumed to be visible for all sessions. |
| 489 | // |
| 490 | // This is fixible with some elbow grease, but at the moment it seems |
| 491 | // unlikely that we'll have a variable in the notify set that shouldn't |
| 492 | // be visible to all sessions. |
| 493 | [ |
| 494 | &APPLICATION_NAME, |
| 495 | &CLIENT_ENCODING, |
| 496 | &DATE_STYLE, |
| 497 | &INTEGER_DATETIMES, |
| 498 | &SERVER_VERSION, |
| 499 | &STANDARD_CONFORMING_STRINGS, |
| 500 | &TIMEZONE, |
| 501 | &INTERVAL_STYLE, |
| 502 | // Including `cluster`, `cluster_replica`, `database`, and `search_path` in the notify |
| 503 | // set is a Materialize extension. Doing so allows users to more easily identify where |
| 504 | // their queries will be executing, which is important to know when you consider the |
| 505 | // size of a cluster, what indexes are present, etc. |
| 506 | &CLUSTER, |
| 507 | &CLUSTER_REPLICA, |
| 508 | &DEFAULT_CLUSTER_REPLICATION_FACTOR, |
| 509 | &DATABASE, |
| 510 | &SEARCH_PATH, |
| 511 | ] |
| 512 | .into_iter() |
| 513 | .map(|v| self.vars[v.name].as_var()) |
| 514 | // Including `mz_version` in the notify set is a Materialize |
| 515 | // extension. Doing so allows applications to detect whether they |
| 516 | // are talking to Materialize or PostgreSQL without an additional |
| 517 | // network roundtrip. This is known to be safe because CockroachDB |
| 518 | // has an analogous extension [0]. |
| 519 | // [0]: https://github.com/cockroachdb/cockroach/blob/369c4057a/pkg/sql/pgwire/conn.go#L1840 |
| 520 | .chain(std::iter::once(self.mz_version.as_var())) |
| 521 | } |
| 522 | |
| 523 | /// Resets all variables to their default value. |
| 524 | pub fn reset_all(&mut self) { |
no test coverage detected