From e8805df5127b842ba1519e031fc0af2ab4099816 Mon Sep 17 00:00:00 2001 From: Philip Lee Date: Wed, 3 Jun 2026 09:05:53 -0400 Subject: [PATCH 1/3] [cilium] strengthen tests to lift mutation score (#23752) * [cilium] add env-agnostic unit tests to lift mutation score The existing tests/test_cilium.py is gated by requires_new_environment, so it skips entirely under the legacy hatch env and runs only a thin slice under the modern env. This left CiliumCheckV2._parse_config, the legacy CiliumCheck __new__/__init__ routing, and construct_metrics_config's suffix stripping with 0% mutation coverage. Add tests/test_unit.py with 29 env-agnostic tests covering: - construct_metrics_config: _total / _counter suffix stripping, passthrough, empty input, iteration, substring-not-suffix. - CiliumCheckV2._parse_config: DEFAULT_METRIC_LIMIT, missing-endpoint validation, agent-only / operator-only / both scraper construction, agent-vs-operator metric set selection. - Legacy CiliumCheck: __new__ routing on use_openmetrics (truthy / falsy / absent / first-instance), __init__ validation (both / neither endpoint), first-instance endpoint selection, operator vs agent metric set, default and custom prometheus_timeout, namespace, metadata_metric_name. Local cosmic-ray run with --test-path tests/test_unit.py: 51 mutants generated, 51 killed, 0 survived (100% from 0%). * [cilium] Replace repr-based metric-set assertions with structural key iteration Co-Authored-By: Claude Sonnet 4.6 (1M context) --------- Co-authored-by: Claude Sonnet 4.6 (1M context) --- cilium/tests/test_unit.py | 212 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 cilium/tests/test_unit.py diff --git a/cilium/tests/test_unit.py b/cilium/tests/test_unit.py new file mode 100644 index 0000000000000..8a6f609c078d2 --- /dev/null +++ b/cilium/tests/test_unit.py @@ -0,0 +1,212 @@ +# (C) Datadog, Inc. 2026-present +# All rights reserved +# Licensed under a 3-clause BSD style license (see LICENSE) +import pytest + +from datadog_checks.base import ConfigurationError +from datadog_checks.cilium import CiliumCheck +from datadog_checks.cilium.check import CiliumCheckV2 +from datadog_checks.cilium.cilium import CiliumCheck as LegacyCiliumCheck +from datadog_checks.cilium.metrics import construct_metrics_config + +pytestmark = pytest.mark.unit + + +def test_construct_metrics_config_strips_total_suffix(): + out = construct_metrics_config({"cilium_drop_count_total": "drop_count.total"}) + assert out == [{"cilium_drop_count": {"name": "drop_count"}}] + + +def test_construct_metrics_config_strips_counter_suffix(): + out = construct_metrics_config({"cilium_api_counter": "api.counter"}) + assert out == [{"cilium_api": {"name": "api"}}] + + +def test_construct_metrics_config_passes_through_when_no_suffix(): + out = construct_metrics_config({"cilium_endpoint": "endpoint.count"}) + assert out == [{"cilium_endpoint": {"name": "endpoint.count"}}] + + +def test_construct_metrics_config_empty_map_returns_empty_list(): + assert construct_metrics_config({}) == [] + + +def test_construct_metrics_config_iterates_every_entry(): + out = construct_metrics_config( + { + "a_total": "a.total", + "b_counter": "b.counter", + "c": "c", + } + ) + assert len(out) == 3 + assert {"a": {"name": "a"}} in out + assert {"b": {"name": "b"}} in out + assert {"c": {"name": "c"}} in out + + +def test_construct_metrics_config_total_substring_not_stripped(): + # "_total" must be a suffix; the substring elsewhere stays intact. + out = construct_metrics_config({"totally_random": "totally.random"}) + assert out == [{"totally_random": {"name": "totally.random"}}] + + +def test_construct_metrics_config_counter_substring_not_stripped(): + out = construct_metrics_config({"countermeasure": "countermeasure"}) + assert out == [{"countermeasure": {"name": "countermeasure"}}] + + +def test_v2_default_metric_limit_is_zero(): + assert CiliumCheckV2.DEFAULT_METRIC_LIMIT == 0 + + +def test_v2_raises_when_neither_endpoint_set(): + check = CiliumCheckV2("cilium", {}, [{}]) + with pytest.raises(ConfigurationError, match="Must specify at least one"): + check._parse_config() + + +def test_v2_agent_endpoint_only_builds_one_scraper_pointing_at_agent(): + check = CiliumCheckV2("cilium", {}, [{"agent_endpoint": "http://agent/metrics"}]) + check._parse_config() + assert len(check.scraper_configs) == 1 + assert check.scraper_configs[0]["openmetrics_endpoint"] == "http://agent/metrics" + + +def test_v2_operator_endpoint_only_builds_one_scraper_pointing_at_operator(): + check = CiliumCheckV2("cilium", {}, [{"operator_endpoint": "http://op/metrics"}]) + check._parse_config() + assert len(check.scraper_configs) == 1 + assert check.scraper_configs[0]["openmetrics_endpoint"] == "http://op/metrics" + + +def test_v2_both_endpoints_build_two_scrapers(): + check = CiliumCheckV2( + "cilium", + {}, + [{"agent_endpoint": "http://agent/metrics", "operator_endpoint": "http://op/metrics"}], + ) + check._parse_config() + endpoints = sorted(s["openmetrics_endpoint"] for s in check.scraper_configs) + assert endpoints == ["http://agent/metrics", "http://op/metrics"] + + +def test_v2_agent_scraper_uses_agent_metrics_not_operator(): + check = CiliumCheckV2("cilium", {}, [{"agent_endpoint": "http://agent/metrics"}]) + check._parse_config() + metric_keys = {next(iter(m)) for m in check.scraper_configs[0]["metrics"]} + assert "cilium_drop_count" in metric_keys + assert not any(name.startswith("cilium_operator_eni_") for name in metric_keys) + + +def test_v2_operator_scraper_uses_operator_metrics_not_agent(): + check = CiliumCheckV2("cilium", {}, [{"operator_endpoint": "http://op/metrics"}]) + check._parse_config() + metric_keys = {next(iter(m)) for m in check.scraper_configs[0]["metrics"]} + assert any(name.startswith("cilium_operator_") for name in metric_keys) + assert "cilium_drop_count" not in metric_keys + + +def test_legacy_default_metric_limit_is_zero(): + assert LegacyCiliumCheck.DEFAULT_METRIC_LIMIT == 0 + + +def test_legacy_routes_to_v2_when_use_openmetrics_is_truthy(): + check = CiliumCheck("cilium", {}, [{"agent_endpoint": "http://agent/metrics", "use_openmetrics": True}]) + assert isinstance(check, CiliumCheckV2) + + +def test_legacy_routes_to_legacy_when_use_openmetrics_is_falsy(): + check = CiliumCheck("cilium", {}, [{"agent_endpoint": "http://agent/metrics", "use_openmetrics": False}]) + assert not isinstance(check, CiliumCheckV2) + + +def test_legacy_default_use_openmetrics_routes_to_legacy(): + # When the key is absent, the get() default must be False so we stay on legacy. + check = CiliumCheck("cilium", {}, [{"agent_endpoint": "http://agent/metrics"}]) + assert not isinstance(check, CiliumCheckV2) + + +def test_legacy_new_picks_first_instance_for_routing_legacy_path(): + check = CiliumCheck( + "cilium", + {}, + [ + {"agent_endpoint": "http://agent/metrics", "use_openmetrics": False}, + {"agent_endpoint": "http://agent2/metrics", "use_openmetrics": True}, + ], + ) + assert not isinstance(check, CiliumCheckV2) + + +def test_legacy_new_picks_first_instance_for_routing_v2_path(): + check = CiliumCheck( + "cilium", + {}, + [ + {"agent_endpoint": "http://agent/metrics", "use_openmetrics": True}, + {"agent_endpoint": "http://agent2/metrics", "use_openmetrics": False}, + ], + ) + assert isinstance(check, CiliumCheckV2) + + +def test_legacy_raises_when_both_endpoints_set(): + with pytest.raises(ConfigurationError, match="Only one endpoint needs to be specified"): + CiliumCheck( + "cilium", + {}, + [{"agent_endpoint": "http://agent/metrics", "operator_endpoint": "http://op/metrics"}], + ) + + +def test_legacy_raises_when_neither_endpoint_set(): + with pytest.raises(ConfigurationError, match="Must provide at least one endpoint"): + CiliumCheck("cilium", {}, [{}]) + + +def test_legacy_init_uses_first_instance_for_endpoint_choice(): + check = CiliumCheck( + "cilium", + {}, + [ + {"agent_endpoint": "http://first/metrics"}, + {"agent_endpoint": "http://second/metrics"}, + ], + ) + assert check.instance["prometheus_url"] == "http://first/metrics" + + +def test_legacy_operator_endpoint_selects_operator_metric_set(): + check = CiliumCheck("cilium", {}, [{"operator_endpoint": "http://op/metrics"}]) + assert check.instance["prometheus_url"] == "http://op/metrics" + metric_keys = {key for m in check.instance["metrics"] for key in m} + assert "cilium_operator_process_cpu_seconds_total" in metric_keys + + +def test_legacy_agent_endpoint_selects_agent_metric_set(): + check = CiliumCheck("cilium", {}, [{"agent_endpoint": "http://agent/metrics"}]) + assert check.instance["prometheus_url"] == "http://agent/metrics" + metric_keys = {key for m in check.instance["metrics"] for key in m} + assert "cilium_drop_count_total" in metric_keys + assert "cilium_operator_eni_available" not in metric_keys + + +def test_legacy_default_prometheus_timeout_is_10(): + check = CiliumCheck("cilium", {}, [{"agent_endpoint": "http://agent/metrics"}]) + assert check.instance["prometheus_timeout"] == 10 + + +def test_legacy_custom_timeout_passes_through(): + check = CiliumCheck("cilium", {}, [{"agent_endpoint": "http://agent/metrics", "timeout": 42}]) + assert check.instance["prometheus_timeout"] == 42 + + +def test_legacy_namespace_is_cilium(): + check = CiliumCheck("cilium", {}, [{"agent_endpoint": "http://agent/metrics"}]) + assert check.instance["namespace"] == "cilium" + + +def test_legacy_metadata_metric_name_is_cilium_version(): + check = CiliumCheck("cilium", {}, [{"agent_endpoint": "http://agent/metrics"}]) + assert check.instance["metadata_metric_name"] == "cilium_version" From 860ccb2f2f4dd1e7a354f8f258cf5853167c7dc6 Mon Sep 17 00:00:00 2001 From: NouemanKHAL Date: Wed, 3 Jun 2026 15:29:40 +0200 Subject: [PATCH 2/3] [nutanix] Warn and skip entities missing extId or name (#23612) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(nutanix): normalize all ntnx_* tags to lowercase with $unknown fallback Route every enum-backed ntnx_* tag (host_type, hypervisor_type, node_status, plus the previously-handled state tags) through a single _norm_state helper so they all follow one rule: lowercase the API value, fall back to "\$unknown" when the source is missing. Picks "\$unknown" (the API spec's own sentinel) as the fallback so there's no mismatch between "value present but says \$UNKNOWN" and "value missing" — both surface as ntnx_X:\$unknown. ntnx_disk_status's "unknown" fallback is updated to "\$unknown" for the same reason. * docs(nutanix): add changelog for tag normalization * docs(nutanix): shorten changelog to one customer-facing line * refactor(nutanix): extract tag values into named variables Hoist _norm_state and get_nested calls out of f-strings in the tag-extraction helpers. Each tag computation now binds to a named local first, making the read top-down and easier to step through. * refactor(nutanix): rename _norm_state to _normalize_tag_value The helper is used for type, state, mode, and status tags — not just state — so the broader name better describes what it does. * refactor(nutanix): collapse node_status to one variable, restore tags = [] Lowercase the node-status comparison sets so the normalized tag value serves both the status_value lookup and the tag emission, removing the need for a separate node_status_tag local. Restore the tags = [] preamble in the tag-extraction helpers since it makes the building intent obvious. * fix(nutanix): normalize powerState in vm.status gauge Match what _report_host_status_metrics does: route the powerState lookup through _normalize_tag_value and lowercase the comparison literals. Removes the asymmetry where vm.status was the only metric still relying on raw uppercase API values. Addresses review feedback on PR #23609. * fix(nutanix): warn and skip entities missing the main id or name Hosts now warn-and-skip when hostName is missing (previously they emitted metrics with hostname=None, useless for correlation), VMs upgrade their existing missing-id/name skip from debug to warning, and clusters now warn-and-skip when name is missing (previously they were processed with no ntnx_cluster_name tag and weren't cached for VM/host cluster-name tagging). * docs(nutanix): add changelog for entity-validation skip * docs(nutanix): shorten changelog to one customer-facing line * refactor(nutanix): rename VM hostname locals/params to vm_name The variable was named after how it's consumed downstream (the hostname= kwarg to gauge calls), not what it actually is — the VM's "name" field from the API. Rename to vm_name for symmetry with host_name on the host side; the gauge call still passes it as hostname=vm_name. * refactor(nutanix): hoist cluster log label to a variable * Delete nutanix/changelog.d/23609.fixed * Keep collecting VMs for unnamed hosts * test(nutanix): add tests for skip behavior on missing entity fields Cover the three new skip paths added in this PR: - VM missing extId: verify vm_count decrements and metric absent - VM missing name: same invariant - Cluster missing name: verify cluster_count unchanged and warning logged Each VM test is parametrized for both batch and non-batch collection modes. Co-Authored-By: Claude Sonnet 4.6 (1M context) --------- Co-authored-by: Claude Sonnet 4.6 (1M context) --- nutanix/changelog.d/23612.fixed | 1 + .../nutanix/infrastructure_monitor.py | 117 +++++++++++------- nutanix/tests/test_clusters.py | 20 +++ nutanix/tests/test_vms.py | 94 ++++++++++++++ 4 files changed, 184 insertions(+), 48 deletions(-) create mode 100644 nutanix/changelog.d/23612.fixed diff --git a/nutanix/changelog.d/23612.fixed b/nutanix/changelog.d/23612.fixed new file mode 100644 index 0000000000000..ec407de5e1b41 --- /dev/null +++ b/nutanix/changelog.d/23612.fixed @@ -0,0 +1 @@ +Skip hosts, VMs, and clusters missing an `extId` or name, and log a warning. diff --git a/nutanix/datadog_checks/nutanix/infrastructure_monitor.py b/nutanix/datadog_checks/nutanix/infrastructure_monitor.py index 7ce89da9dce8d..5bc1da26a0a1a 100644 --- a/nutanix/datadog_checks/nutanix/infrastructure_monitor.py +++ b/nutanix/datadog_checks/nutanix/infrastructure_monitor.py @@ -152,10 +152,12 @@ def collect_cluster_metrics(self) -> None: # Process each cluster processed, skipped = 0, 0 for cluster in clusters: - cluster_name = cluster.get("name", "unknown") + cluster_id = cluster.get("extId") + cluster_name = cluster.get("name") + cluster_label = cluster_name or "unknown" if self._is_prism_central_cluster(cluster): - self.check.log.info("[%s] Skipping Prism Central cluster: %s", self._pc_label, cluster_name) + self.check.log.info("[%s] Skipping Prism Central cluster: %s", self._pc_label, cluster_label) self._collect_pc_version_metadata(cluster) skipped += 1 continue @@ -164,9 +166,13 @@ def collect_cluster_metrics(self) -> None: skipped += 1 continue - cluster_id = cluster.get("extId") if not cluster_id: - self.check.log.warning("[%s][%s] Cluster has no extId, skipping", self._pc_label, cluster_name) + self.check.log.warning("[%s] Cluster %s has no extId, skipping", self._pc_label, cluster_label) + skipped += 1 + continue + + if not cluster_name: + self.check.log.warning("[%s] Cluster %s has no name, skipping", self._pc_label, cluster_id) skipped += 1 continue @@ -220,29 +226,32 @@ def _report_cluster_metrics( def _process_vm(self, vm: dict, vm_stats_dict: dict[str, list[dict]], cluster_name: str) -> bool: """Report metrics for a single VM if it passes filters.""" vm_id = vm.get("extId") - hostname = vm.get("name") - if not vm_id or not hostname: - self.check.log.debug("[%s][%s] Skipping VM missing extId or name: %r", self._pc_label, cluster_name, vm) + vm_name = vm.get("name") + if not vm_id: + self.check.log.warning("[%s][%s] VM %s has no extId, skipping", self._pc_label, cluster_name, vm_name) + return False + if not vm_name: + self.check.log.warning("[%s][%s] VM %s has no name, skipping", self._pc_label, cluster_name, vm_id) return False if not self._should_collect_vm(vm): return False vm_tags = self.check.base_tags + self._extract_vm_tags(vm) - self._set_external_tags_for_host(hostname, vm_tags) - self._report_vm_basic_metrics(vm, hostname, vm_tags) - self._report_vm_stats(vm_id, hostname, vm_tags, vm_stats_dict, cluster_name) + self._set_external_tags_for_host(vm_name, vm_tags) + self._report_vm_basic_metrics(vm, vm_name, vm_tags) + self._report_vm_stats(vm_id, vm_name, vm_tags, vm_stats_dict, cluster_name) return True - def _report_vm_basic_metrics(self, vm: dict, hostname: str, vm_tags: list[str]) -> None: + def _report_vm_basic_metrics(self, vm: dict, vm_name: str, vm_tags: list[str]) -> None: """Report basic VM metrics (counts and status).""" - self.check.gauge("vm.count", 1, hostname=hostname, tags=vm_tags) + self.check.gauge("vm.count", 1, hostname=vm_name, tags=vm_tags) power_state = _normalize_tag_value(vm.get("powerState")) status_value = 0 if power_state == "on" else 1 if power_state == "paused" else 2 - self.check.gauge("vm.status", status_value, hostname=hostname, tags=vm_tags) + self.check.gauge("vm.status", status_value, hostname=vm_name, tags=vm_tags) - self._report_vm_capacity_metrics(vm, hostname, vm_tags) + self._report_vm_capacity_metrics(vm, vm_name, vm_tags) def _extract_vm_capacity(self, vm: dict) -> tuple[int, int, int, int, int]: """Return (sockets, cores_per_socket, threads_per_core, vcpus_allocated, memory_bytes) for a VM.""" @@ -258,19 +267,19 @@ def _extract_vm_disk_capacity_bytes(self, vm: dict) -> int: int(get_nested(d, "backingInfo/diskSizeBytes") or 0) for d in vm.get("disks") or [] if isinstance(d, dict) ) - def _report_vm_capacity_metrics(self, vm: dict, hostname: str, vm_tags: list[str]) -> None: + def _report_vm_capacity_metrics(self, vm: dict, vm_name: str, vm_tags: list[str]) -> None: """Report VM capacity metrics (CPU, memory, and disk allocation).""" num_sockets, num_cores_per_socket, num_threads_per_core, vcpus_allocated, memory_bytes = ( self._extract_vm_capacity(vm) ) - self.check.gauge("vm.cpu.sockets", num_sockets, hostname=hostname, tags=vm_tags) - self.check.gauge("vm.cpu.cores_per_socket", num_cores_per_socket, hostname=hostname, tags=vm_tags) - self.check.gauge("vm.cpu.threads_per_core", num_threads_per_core, hostname=hostname, tags=vm_tags) - self.check.gauge("vm.cpu.vcpus_allocated", vcpus_allocated, hostname=hostname, tags=vm_tags) - self.check.gauge("vm.memory.allocated_bytes", memory_bytes, hostname=hostname, tags=vm_tags) + self.check.gauge("vm.cpu.sockets", num_sockets, hostname=vm_name, tags=vm_tags) + self.check.gauge("vm.cpu.cores_per_socket", num_cores_per_socket, hostname=vm_name, tags=vm_tags) + self.check.gauge("vm.cpu.threads_per_core", num_threads_per_core, hostname=vm_name, tags=vm_tags) + self.check.gauge("vm.cpu.vcpus_allocated", vcpus_allocated, hostname=vm_name, tags=vm_tags) + self.check.gauge("vm.memory.allocated_bytes", memory_bytes, hostname=vm_name, tags=vm_tags) self.check.gauge( - "vm.disk_capacity_bytes", self._extract_vm_disk_capacity_bytes(vm), hostname=hostname, tags=vm_tags + "vm.disk_capacity_bytes", self._extract_vm_disk_capacity_bytes(vm), hostname=vm_name, tags=vm_tags ) def _report_cluster_basic_metrics(self, cluster: dict, cluster_tags: list[str]) -> None: @@ -357,17 +366,17 @@ def _report_cluster_stats(self, cluster_name: str, cluster_id: str, cluster_tags ) def _report_vm_stats( - self, vm_id: str, hostname: str, vm_tags: list[str], vm_stats_dict: dict, cluster_name: str + self, vm_id: str, vm_name: str, vm_tags: list[str], vm_stats_dict: dict, cluster_name: str ) -> None: """Report time-series stats for a VM.""" stats = vm_stats_dict.get(vm_id) if stats: self._report_stats( - f"[{self._pc_label}][{cluster_name}] VM {hostname}", + f"[{self._pc_label}][{cluster_name}] VM {vm_name}", stats, VM_STATS_METRICS, vm_tags, - hostname=hostname, + hostname=vm_name, ) def _process_hosts( @@ -409,43 +418,55 @@ def _process_single_host( self.check.log.warning("[%s][%s] Host %s has no extId, skipping", self._pc_label, cluster_name, host_name) return + skip_host_metrics = False + if not host_name: + self.check.log.warning( + "[%s][%s] Host %s has no hostName, skipping host metrics", + self._pc_label, + cluster_name, + host_id, + ) + skip_host_metrics = True + if not should_collect_resource("host", host, self.check.resource_filters, self.check.log): return - self.host_count += 1 - - if host_name: + if not skip_host_metrics: + self.host_count += 1 self.host_names[host_id] = host_name - host_tags = cluster_tags + self._extract_host_tags(host) - self.check.gauge("host.count", 1, hostname=host_name, tags=host_tags) - self._report_host_status_metrics(host, host_name, host_tags) - self._set_external_tags_for_host(host_name, host_tags) - self._report_host_capacity_metrics(host, host_name, host_tags) + host_tags = cluster_tags + self._extract_host_tags(host) + self.check.gauge("host.count", 1, hostname=host_name, tags=host_tags) + self._report_host_status_metrics(host, host_name, host_tags) + self._set_external_tags_for_host(host_name, host_tags) + self._report_host_capacity_metrics(host, host_name, host_tags) - try: - stats = self._get_stats(f"api/clustermgmt/v4.0/stats/clusters/{cluster_id}/hosts/{host_id}") - if stats: - self._report_stats( - f"[{self._pc_label}][{cluster_name}] Host {host_name}", - stats, - HOST_STATS_METRICS, - host_tags, - hostname=host_name, - extra_tags_by_key=self._get_disk_status_storage_tags(host_id), + try: + stats = self._get_stats(f"api/clustermgmt/v4.0/stats/clusters/{cluster_id}/hosts/{host_id}") + if stats: + self._report_stats( + f"[{self._pc_label}][{cluster_name}] Host {host_name}", + stats, + HOST_STATS_METRICS, + host_tags, + hostname=host_name, + extra_tags_by_key=self._get_disk_status_storage_tags(host_id), + ) + except Exception: + self.check.log.exception( + "[%s][%s] Failed to fetch stats for host %s", self._pc_label, cluster_name, host_name ) - except Exception: - self.check.log.exception( - "[%s][%s] Failed to fetch stats for host %s", self._pc_label, cluster_name, host_name - ) + host_label = host_name or host_id try: vms = self._get_vms_for_host(host_id) except Exception: - self.check.log.exception("[%s][%s] Failed to list VMs for host %s", self._pc_label, cluster_name, host_name) + self.check.log.exception( + "[%s][%s] Failed to list VMs for host %s", self._pc_label, cluster_name, host_label + ) return - self.check.log.debug("[%s][%s] Host %s has %d VMs", self._pc_label, cluster_name, host_name, len(vms)) + self.check.log.debug("[%s][%s] Host %s has %d VMs", self._pc_label, cluster_name, host_label, len(vms)) for vm in vms: if self._process_vm(vm, cluster_vm_stats_dict, cluster_name): self.vm_count += 1 diff --git a/nutanix/tests/test_clusters.py b/nutanix/tests/test_clusters.py index a6793b5575ef1..a3562b8220434 100644 --- a/nutanix/tests/test_clusters.py +++ b/nutanix/tests/test_clusters.py @@ -4,10 +4,12 @@ import logging +from copy import deepcopy import pytest from datadog_checks.nutanix import NutanixCheck +from tests.conftest import load_fixture_page from tests.constants import BASE_TAGS, CLUSTER_TAGS pytestmark = [pytest.mark.unit] @@ -92,6 +94,24 @@ def test_prism_central_cluster_skipped(dd_run_check, aggregator, mock_instance, assert len(pc_metrics) == 0 +def test_cluster_with_no_name_is_skipped( + dd_run_check, aggregator, mock_instance, mock_http_get, mocker, caplog +) -> None: + clusters = deepcopy(load_fixture_page("clusters.json", 0)["data"]) + clusters.append({"extId": "no-name-cluster-id", "config": {"clusterFunction": ["AOS"]}}) + mocker.patch( + "datadog_checks.nutanix.infrastructure_monitor.InfrastructureMonitor._list_clusters", + return_value=clusters, + ) + + check = NutanixCheck('nutanix', {}, [mock_instance]) + with caplog.at_level(logging.WARNING): + dd_run_check(check) + + assert check.infrastructure_monitor.cluster_count == 2 + assert any("no-name-cluster-id" in r.message and "has no name" in r.message for r in caplog.records) + + def test_missing_pc_ip_raises_error(dd_run_check): with pytest.raises(Exception, match="(?s)pc_ip.*required"): check = NutanixCheck('nutanix', {}, [{"pc_username": "admin", "pc_password": "secret"}]) diff --git a/nutanix/tests/test_vms.py b/nutanix/tests/test_vms.py index 83f813f3e186c..e9ab216049fe7 100644 --- a/nutanix/tests/test_vms.py +++ b/nutanix/tests/test_vms.py @@ -2,10 +2,12 @@ # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) +from copy import deepcopy import pytest from datadog_checks.nutanix import NutanixCheck +from tests.conftest import load_fixture_page from tests.constants import OFF_VM_NAME, OFF_VM_TAGS, PCVM_NAME, PCVM_TAGS from tests.metrics import VM_STATS_METRICS_REQUIRED @@ -68,6 +70,98 @@ def test_batch_and_non_batch_produce_same_counts( aggregator.assert_metric("nutanix.cluster.count", count=2) +@pytest.mark.parametrize("batch_vm_collection", [True, False]) +def test_vms_collected_when_host_missing_name( + dd_run_check, aggregator, mock_instance, mock_http_get, mocker, batch_vm_collection +) -> None: + mock_instance["batch_vm_collection"] = batch_vm_collection + + hosts = deepcopy(load_fixture_page("hosts_00064715.json", 0)["data"]) + hosts[0].pop("hostName") + hosts_by_cluster = { + "00064715-c043-5d8f-ee4b-176ec875554d": hosts, + "aabbccdd-1111-2222-3333-444455556666": deepcopy(load_fixture_page("hosts_aabbccdd.json", 0)["data"]), + } + mocker.patch( + "datadog_checks.nutanix.infrastructure_monitor.InfrastructureMonitor._list_hosts_by_cluster", + side_effect=lambda cluster_id: hosts_by_cluster[cluster_id], + ) + + check = NutanixCheck('nutanix', {}, [mock_instance]) + dd_run_check(check) + + vm_names = { + tag.split(":", 1)[1] + for m in aggregator.metrics("nutanix.vm.count") + for tag in m.tags + if tag.startswith("ntnx_vm_name:") + } + assert {PCVM_NAME, "ubuntu-vm", "random-vm"}.issubset(vm_names) + assert check.infrastructure_monitor.host_count == 1 + aggregator.assert_metric("nutanix.vm.count", count=4) + aggregator.assert_metric("nutanix.host.count", count=1) + + +@pytest.mark.parametrize("batch_vm_collection", [True, False]) +def test_vm_with_no_extid_is_skipped( + dd_run_check, aggregator, mock_instance, mock_http_get, mocker, batch_vm_collection +) -> None: + mock_instance["batch_vm_collection"] = batch_vm_collection + + all_vms = deepcopy(load_fixture_page("vms.json", 0)["data"]) + vms_by_host: dict[str, list] = {} + for vm in all_vms: + host_id = (vm.get("host") or {}).get("extId") or "" + vms_by_host.setdefault(host_id, []).append(vm) + + ubuntu_vm = next(v for v in vms_by_host["d8787814-4fe8-4ba5-931f-e1ee31c294a6"] if v.get("name") == "ubuntu-vm") + ubuntu_vm.pop("extId") + + mocker.patch( + "datadog_checks.nutanix.infrastructure_monitor.InfrastructureMonitor._get_vms_for_host", + side_effect=lambda h: vms_by_host.get(h, []), + ) + + check = NutanixCheck('nutanix', {}, [mock_instance]) + dd_run_check(check) + + assert check.infrastructure_monitor.vm_count == 3 + vm_names = { + tag.split(":", 1)[1] + for m in aggregator.metrics("nutanix.vm.count") + for tag in m.tags + if tag.startswith("ntnx_vm_name:") + } + assert "ubuntu-vm" not in vm_names + + +@pytest.mark.parametrize("batch_vm_collection", [True, False]) +def test_vm_with_no_name_is_skipped( + dd_run_check, aggregator, mock_instance, mock_http_get, mocker, batch_vm_collection +) -> None: + mock_instance["batch_vm_collection"] = batch_vm_collection + + all_vms = deepcopy(load_fixture_page("vms.json", 0)["data"]) + vms_by_host: dict[str, list] = {} + for vm in all_vms: + host_id = (vm.get("host") or {}).get("extId") or "" + vms_by_host.setdefault(host_id, []).append(vm) + + ubuntu_vm = next(v for v in vms_by_host["d8787814-4fe8-4ba5-931f-e1ee31c294a6"] if v.get("name") == "ubuntu-vm") + ubuntu_vm.pop("name") + + mocker.patch( + "datadog_checks.nutanix.infrastructure_monitor.InfrastructureMonitor._get_vms_for_host", + side_effect=lambda h: vms_by_host.get(h, []), + ) + + check = NutanixCheck('nutanix', {}, [mock_instance]) + dd_run_check(check) + + assert check.infrastructure_monitor.vm_count == 3 + aggregator.assert_metric("nutanix.vm.count", count=3) + + def test_external_tags_for_vm(dd_run_check, aggregator, mock_instance, mock_http_get, datadog_agent): check = NutanixCheck('nutanix', {}, [mock_instance]) dd_run_check(check) From ae88816e57339c046d0aaaa4fce8d68316745446 Mon Sep 17 00:00:00 2001 From: Maciej Obuchowski Date: Wed, 3 Jun 2026 15:38:14 +0200 Subject: [PATCH 3/3] postgres: collect relkind in schema metadata (#23888) * postgres: collect relkind (incl views/matviews) in schema metadata - Add c.relkind to PG_TABLES_QUERY_V10_PLUS and PG_TABLES_QUERY_V9 SELECT lists - Expand relkind filter to include views ('v') and materialized views ('m') - Propagate relkind through get_rows_query() schema_tables CTE, final SELECT, and GROUP BY - Add relkind: str to TableObject TypedDict - Add relkind to _map_row() per-table payload - Add CREATE VIEW and CREATE MATERIALIZED VIEW to test database setup SQL - Update test assertions to verify relkind is present and correct - Update schema snapshot fixtures: add relkind to all existing tables, add persons_view and persons_matview entries (fixtures need regeneration in CI with actual OIDs via test_collect_schema_snapshot auto-update) Environment: Datadog workspace Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Maciej Obuchowski * remove pulling (materialized) views Signed-off-by: Maciej Obuchowski * changelog entry Signed-off-by: Maciej Obuchowski * Tighten relkind assertion to match collector query policy The collector query in schemas.py only returns relkind values 'r', 'p', and 'f' (regular tables, partitioned tables, foreign tables). Tighten the test assertion to match, removing 'v' and 'm' which were included when views/matviews were considered but then removed. Environment: Datadog workspace Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Maciej Obuchowski --------- Signed-off-by: Maciej Obuchowski Signed-off-by: Maciej Obuchowski Co-authored-by: Claude Sonnet 4.6 --- postgres/changelog.d/23888.added | 1 + postgres/datadog_checks/postgres/schemas.py | 12 +++- .../tests/fixtures/schema_snapshot_v10_C.json | 60 ++++++++++------ .../fixtures/schema_snapshot_v10_UTF8.json | 60 ++++++++++------ .../tests/fixtures/schema_snapshot_v11_C.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v11_UTF8.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v12.17_C.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v12.17_UTF8.json | 69 ++++++++++++------- .../tests/fixtures/schema_snapshot_v13_C.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v13_UTF8.json | 69 ++++++++++++------- .../tests/fixtures/schema_snapshot_v14_C.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v14_UTF8.json | 69 ++++++++++++------- .../tests/fixtures/schema_snapshot_v15_C.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v15_UTF8.json | 69 ++++++++++++------- .../tests/fixtures/schema_snapshot_v16_C.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v16_UTF8.json | 69 ++++++++++++------- .../tests/fixtures/schema_snapshot_v17_C.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v17_UTF8.json | 69 ++++++++++++------- .../tests/fixtures/schema_snapshot_v18_C.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v18_UTF8.json | 69 ++++++++++++------- .../fixtures/schema_snapshot_v9.6_UTF8.json | 60 ++++++++++------ postgres/tests/test_metadata.py | 2 + 22 files changed, 868 insertions(+), 431 deletions(-) create mode 100644 postgres/changelog.d/23888.added diff --git a/postgres/changelog.d/23888.added b/postgres/changelog.d/23888.added new file mode 100644 index 0000000000000..497d296ede54f --- /dev/null +++ b/postgres/changelog.d/23888.added @@ -0,0 +1 @@ +Collect ``relkind`` for Postgres tables in DBM schema metadata. diff --git a/postgres/datadog_checks/postgres/schemas.py b/postgres/datadog_checks/postgres/schemas.py index b263060dbd59a..fb4dca189b19e 100644 --- a/postgres/datadog_checks/postgres/schemas.py +++ b/postgres/datadog_checks/postgres/schemas.py @@ -41,6 +41,7 @@ class DatabaseObject(TypedDict): c.relnamespace AS schema_id, c.relname AS table_name, c.relowner :: regrole :: text AS table_owner, + c.relkind::text AS relkind, t.relname AS toast_table FROM pg_class c left join pg_class t @@ -54,6 +55,7 @@ class DatabaseObject(TypedDict): c.relnamespace AS schema_id, c.relname AS table_name, c.relowner :: regrole :: text AS table_owner, + c.relkind::text AS relkind, t.relname AS toast_table FROM pg_class c left join pg_class t @@ -138,6 +140,7 @@ class DatabaseObject(TypedDict): class TableObject(TypedDict): id: str name: str + relkind: str columns: list indexes: list foreign_keys: list @@ -315,7 +318,7 @@ def get_rows_query(self): ), schema_tables AS ( SELECT schemas.schema_id, schemas.schema_name, schemas.schema_owner, - tables.table_id, tables.table_name, tables.table_owner, tables.toast_table + tables.table_id, tables.table_name, tables.table_owner, tables.relkind, tables.toast_table FROM schemas LEFT JOIN tables ON schemas.schema_id = tables.schema_id ORDER BY schemas.schema_name, tables.table_name @@ -333,7 +336,8 @@ def get_rows_query(self): {partitions_ctes} SELECT schema_tables.schema_id, schema_tables.schema_name, schema_tables.schema_owner, - schema_tables.table_id, schema_tables.table_name, schema_tables.table_owner, schema_tables.toast_table, + schema_tables.table_id, schema_tables.table_name, schema_tables.table_owner, schema_tables.relkind, + schema_tables.toast_table, array_agg(row_to_json(columns.*)) FILTER (WHERE columns.name IS NOT NULL) as columns, array_agg(row_to_json(indexes.*)) FILTER (WHERE indexes.name IS NOT NULL) as indexes, array_agg(row_to_json(constraints.*)) FILTER (WHERE constraints.name IS NOT NULL) @@ -345,7 +349,8 @@ def get_rows_query(self): LEFT JOIN constraints ON schema_tables.table_id = constraints.table_id {partition_joins} GROUP BY schema_tables.schema_id, schema_tables.schema_name, schema_tables.schema_owner, - schema_tables.table_id, schema_tables.table_name, schema_tables.table_owner, schema_tables.toast_table + schema_tables.table_id, schema_tables.table_name, schema_tables.table_owner, schema_tables.relkind, + schema_tables.toast_table ; """ @@ -382,6 +387,7 @@ def _map_row(self, database: DatabaseInfo, cursor_row) -> DatabaseObject: "foreign_keys": list( {v and v['name']: v for v in cursor_row.get("foreign_keys") or []}.values() ), + "relkind": cursor_row.get("relkind"), "toast_table": cursor_row.get("toast_table"), "num_partitions": cursor_row.get("num_partitions"), "partition_key": cursor_row.get("partition_key"), diff --git a/postgres/tests/fixtures/schema_snapshot_v10_C.json b/postgres/tests/fixtures/schema_snapshot_v10_C.json index 7e2351e28eca9..716070d0bd451 100644 --- a/postgres/tests/fixtures/schema_snapshot_v10_C.json +++ b/postgres/tests/fixtures/schema_snapshot_v10_C.json @@ -53,7 +53,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -113,7 +114,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -167,7 +169,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -227,7 +230,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -287,7 +291,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -362,7 +367,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -422,7 +428,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -482,7 +489,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -542,7 +550,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -602,7 +611,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -662,7 +672,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -722,7 +733,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -782,7 +794,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -848,7 +861,8 @@ "definition": "FOREIGN KEY (city) REFERENCES cities(city)", "table_id": "16641" } - ] + ], + "relkind": "r" } ] } @@ -908,7 +922,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -963,7 +978,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1018,7 +1034,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1078,7 +1095,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1138,7 +1156,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1214,7 +1233,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v10_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v10_UTF8.json index 2dccccc0eebc5..8b220e6c7a3fc 100644 --- a/postgres/tests/fixtures/schema_snapshot_v10_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v10_UTF8.json @@ -54,7 +54,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16723" + "toast_table": "pg_toast_16723", + "relkind": "r" } ] } @@ -108,7 +109,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -169,7 +171,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16729" + "toast_table": "pg_toast_16729", + "relkind": "r" } ] } @@ -230,7 +233,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16681" + "toast_table": "pg_toast_16681", + "relkind": "r" } ] } @@ -291,7 +295,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16711" + "toast_table": "pg_toast_16711", + "relkind": "r" } ] } @@ -352,7 +357,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16675" + "toast_table": "pg_toast_16675", + "relkind": "r" } ] } @@ -429,7 +435,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16735" + "toast_table": "pg_toast_16735", + "relkind": "r" } ] } @@ -490,7 +497,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16699" + "toast_table": "pg_toast_16699", + "relkind": "r" } ] } @@ -566,7 +574,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16745" + "toast_table": "pg_toast_16745", + "relkind": "r" } ] } @@ -622,7 +631,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16634" + "toast_table": "pg_toast_16634", + "relkind": "r" } ] } @@ -683,7 +693,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16717" + "toast_table": "pg_toast_16717", + "relkind": "r" } ] } @@ -744,7 +755,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16657" + "toast_table": "pg_toast_16657", + "relkind": "r" } ] } @@ -811,7 +823,8 @@ "table_id": "16644" } ], - "toast_table": "pg_toast_16644" + "toast_table": "pg_toast_16644", + "relkind": "r" } ] } @@ -872,7 +885,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16687" + "toast_table": "pg_toast_16687", + "relkind": "r" } ] } @@ -933,7 +947,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16754" + "toast_table": "pg_toast_16754", + "relkind": "r" } ] } @@ -994,7 +1009,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16705" + "toast_table": "pg_toast_16705", + "relkind": "r" } ] } @@ -1055,7 +1071,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16693" + "toast_table": "pg_toast_16693", + "relkind": "r" } ] } @@ -1116,7 +1133,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16663" + "toast_table": "pg_toast_16663", + "relkind": "r" } ] } @@ -1172,7 +1190,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16762" + "toast_table": "pg_toast_16762", + "relkind": "r" } ] } @@ -1233,7 +1252,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16669" + "toast_table": "pg_toast_16669", + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v11_C.json b/postgres/tests/fixtures/schema_snapshot_v11_C.json index 0d6ef9c0fea2f..c33a58975dbc3 100644 --- a/postgres/tests/fixtures/schema_snapshot_v11_C.json +++ b/postgres/tests/fixtures/schema_snapshot_v11_C.json @@ -79,7 +79,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -151,7 +152,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -211,7 +213,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -250,7 +253,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -310,7 +314,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -370,7 +375,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -430,7 +436,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -490,7 +497,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -566,7 +574,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -626,7 +635,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -686,7 +696,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -746,7 +757,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -806,7 +818,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -866,7 +879,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -932,7 +946,8 @@ "definition": "FOREIGN KEY (city) REFERENCES cities(city)", "table_id": "16653" } - ] + ], + "relkind": "r" } ] } @@ -992,7 +1007,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1047,7 +1063,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1107,7 +1124,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1167,7 +1185,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1222,7 +1241,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1279,7 +1299,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1339,7 +1360,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1399,7 +1421,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v11_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v11_UTF8.json index 85e9c34ac1c8c..b1d09fc645bea 100644 --- a/postgres/tests/fixtures/schema_snapshot_v11_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v11_UTF8.json @@ -49,7 +49,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16646" + "toast_table": "pg_toast_16646", + "relkind": "r" } ] } @@ -110,7 +111,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16675" + "toast_table": "pg_toast_16675", + "relkind": "r" } ] } @@ -187,7 +189,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16747" + "toast_table": "pg_toast_16747", + "relkind": "r" } ] } @@ -248,7 +251,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16711" + "toast_table": "pg_toast_16711", + "relkind": "r" } ] } @@ -320,7 +324,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -381,7 +386,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16705" + "toast_table": "pg_toast_16705", + "relkind": "r" } ] } @@ -457,7 +463,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16717" + "toast_table": "pg_toast_16717", + "relkind": "r" } ] } @@ -518,7 +525,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16669" + "toast_table": "pg_toast_16669", + "relkind": "r" } ] } @@ -574,7 +582,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -635,7 +644,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16681" + "toast_table": "pg_toast_16681", + "relkind": "r" } ] } @@ -696,7 +706,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16699" + "toast_table": "pg_toast_16699", + "relkind": "r" } ] } @@ -757,7 +768,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16741" + "toast_table": "pg_toast_16741", + "relkind": "r" } ] } @@ -818,7 +830,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16735" + "toast_table": "pg_toast_16735", + "relkind": "r" } ] } @@ -879,7 +892,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16729" + "toast_table": "pg_toast_16729", + "relkind": "r" } ] } @@ -940,7 +954,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16693" + "toast_table": "pg_toast_16693", + "relkind": "r" } ] } @@ -979,7 +994,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -1035,7 +1051,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16774" + "toast_table": "pg_toast_16774", + "relkind": "r" } ] } @@ -1096,7 +1113,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16723" + "toast_table": "pg_toast_16723", + "relkind": "r" } ] } @@ -1163,7 +1181,8 @@ "table_id": "16656" } ], - "toast_table": "pg_toast_16656" + "toast_table": "pg_toast_16656", + "relkind": "r" } ] } @@ -1224,7 +1243,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16757" + "toast_table": "pg_toast_16757", + "relkind": "r" } ] } @@ -1285,7 +1305,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16687" + "toast_table": "pg_toast_16687", + "relkind": "r" } ] } @@ -1357,7 +1378,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1418,7 +1440,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16766" + "toast_table": "pg_toast_16766", + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v12.17_C.json b/postgres/tests/fixtures/schema_snapshot_v12.17_C.json index 8939da47a10c3..82936bf55a7a1 100644 --- a/postgres/tests/fixtures/schema_snapshot_v12.17_C.json +++ b/postgres/tests/fixtures/schema_snapshot_v12.17_C.json @@ -53,7 +53,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -110,7 +111,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -197,7 +199,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -252,7 +255,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -312,7 +316,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -372,7 +377,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -432,7 +438,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -492,7 +499,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -552,7 +560,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -608,7 +617,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -668,7 +678,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -728,7 +739,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -783,7 +795,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -843,7 +856,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -903,7 +917,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -963,7 +978,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1029,7 +1045,8 @@ "definition": "FOREIGN KEY (city) REFERENCES cities(city)", "table_id": "16655" } - ] + ], + "relkind": "r" } ] } @@ -1089,7 +1106,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1149,7 +1167,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1188,7 +1207,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -1264,7 +1284,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1339,7 +1360,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1399,7 +1421,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v12.17_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v12.17_UTF8.json index 6cf4e49d3ca5f..9fd04044c64e9 100644 --- a/postgres/tests/fixtures/schema_snapshot_v12.17_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v12.17_UTF8.json @@ -54,7 +54,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16707" + "toast_table": "pg_toast_16707", + "relkind": "r" } ] } @@ -111,7 +112,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -172,7 +174,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16759" + "toast_table": "pg_toast_16759", + "relkind": "r" } ] } @@ -233,7 +236,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16719" + "toast_table": "pg_toast_16719", + "relkind": "r" } ] } @@ -294,7 +298,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16701" + "toast_table": "pg_toast_16701", + "relkind": "r" } ] } @@ -355,7 +360,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16713" + "toast_table": "pg_toast_16713", + "relkind": "r" } ] } @@ -411,7 +417,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16776" + "toast_table": "pg_toast_16776", + "relkind": "r" } ] } @@ -472,7 +479,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16695" + "toast_table": "pg_toast_16695", + "relkind": "r" } ] } @@ -544,7 +552,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -605,7 +614,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16671" + "toast_table": "pg_toast_16671", + "relkind": "r" } ] } @@ -666,7 +676,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16768" + "toast_table": "pg_toast_16768", + "relkind": "r" } ] } @@ -733,7 +744,8 @@ "table_id": "16658" } ], - "toast_table": "pg_toast_16658" + "toast_table": "pg_toast_16658", + "relkind": "r" } ] } @@ -810,7 +822,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16749" + "toast_table": "pg_toast_16749", + "relkind": "r" } ] } @@ -866,7 +879,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -927,7 +941,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16677" + "toast_table": "pg_toast_16677", + "relkind": "r" } ] } @@ -988,7 +1003,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16737" + "toast_table": "pg_toast_16737", + "relkind": "r" } ] } @@ -1049,7 +1065,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16743" + "toast_table": "pg_toast_16743", + "relkind": "r" } ] } @@ -1105,7 +1122,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16648" + "toast_table": "pg_toast_16648", + "relkind": "r" } ] } @@ -1166,7 +1184,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16725" + "toast_table": "pg_toast_16725", + "relkind": "r" } ] } @@ -1227,7 +1246,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16689" + "toast_table": "pg_toast_16689", + "relkind": "r" } ] } @@ -1288,7 +1308,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16683" + "toast_table": "pg_toast_16683", + "relkind": "r" } ] } @@ -1349,7 +1370,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16731" + "toast_table": "pg_toast_16731", + "relkind": "r" } ] } @@ -1418,7 +1440,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v13_C.json b/postgres/tests/fixtures/schema_snapshot_v13_C.json index b7ea0d88676a7..48ce578f9c76b 100644 --- a/postgres/tests/fixtures/schema_snapshot_v13_C.json +++ b/postgres/tests/fixtures/schema_snapshot_v13_C.json @@ -53,7 +53,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -110,7 +111,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -170,7 +172,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -230,7 +233,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -285,7 +289,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -340,7 +345,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -400,7 +406,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -460,7 +467,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -535,7 +543,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -595,7 +604,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -651,7 +661,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -723,7 +734,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -783,7 +795,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -822,7 +835,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -882,7 +896,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -948,7 +963,8 @@ "definition": "FOREIGN KEY (city) REFERENCES cities(city)", "table_id": "16659" } - ] + ], + "relkind": "r" } ] } @@ -1008,7 +1024,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1084,7 +1101,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1144,7 +1162,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1204,7 +1223,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1264,7 +1284,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1324,7 +1345,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1384,7 +1406,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v13_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v13_UTF8.json index 0d8ed076f87d9..6ae649d0b5b8a 100644 --- a/postgres/tests/fixtures/schema_snapshot_v13_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v13_UTF8.json @@ -32,7 +32,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -104,7 +105,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -165,7 +167,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16681" + "toast_table": "pg_toast_16681", + "relkind": "r" } ] } @@ -226,7 +229,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16711" + "toast_table": "pg_toast_16711", + "relkind": "r" } ] } @@ -283,7 +287,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -339,7 +344,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -400,7 +406,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16687" + "toast_table": "pg_toast_16687", + "relkind": "r" } ] } @@ -461,7 +468,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16717" + "toast_table": "pg_toast_16717", + "relkind": "r" } ] } @@ -522,7 +530,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16729" + "toast_table": "pg_toast_16729", + "relkind": "r" } ] } @@ -598,7 +607,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16699" + "toast_table": "pg_toast_16699", + "relkind": "r" } ] } @@ -659,7 +669,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16741" + "toast_table": "pg_toast_16741", + "relkind": "r" } ] } @@ -715,7 +726,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16780" + "toast_table": "pg_toast_16780", + "relkind": "r" } ] } @@ -776,7 +788,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16735" + "toast_table": "pg_toast_16735", + "relkind": "r" } ] } @@ -832,7 +845,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16652" + "toast_table": "pg_toast_16652", + "relkind": "r" } ] } @@ -908,7 +922,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16772" + "toast_table": "pg_toast_16772", + "relkind": "r" } ] } @@ -985,7 +1000,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16753" + "toast_table": "pg_toast_16753", + "relkind": "r" } ] } @@ -1046,7 +1062,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16747" + "toast_table": "pg_toast_16747", + "relkind": "r" } ] } @@ -1107,7 +1124,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16705" + "toast_table": "pg_toast_16705", + "relkind": "r" } ] } @@ -1168,7 +1186,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16675" + "toast_table": "pg_toast_16675", + "relkind": "r" } ] } @@ -1229,7 +1248,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16723" + "toast_table": "pg_toast_16723", + "relkind": "r" } ] } @@ -1290,7 +1310,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16693" + "toast_table": "pg_toast_16693", + "relkind": "r" } ] } @@ -1357,7 +1378,8 @@ "table_id": "16662" } ], - "toast_table": "pg_toast_16662" + "toast_table": "pg_toast_16662", + "relkind": "r" } ] } @@ -1418,7 +1440,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16763" + "toast_table": "pg_toast_16763", + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v14_C.json b/postgres/tests/fixtures/schema_snapshot_v14_C.json index 146088172d616..774cf79de9d15 100644 --- a/postgres/tests/fixtures/schema_snapshot_v14_C.json +++ b/postgres/tests/fixtures/schema_snapshot_v14_C.json @@ -53,7 +53,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -113,7 +114,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -173,7 +175,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -228,7 +231,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -288,7 +292,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -354,7 +359,8 @@ "definition": "FOREIGN KEY (city) REFERENCES cities(city)", "table_id": "16661" } - ] + ], + "relkind": "r" } ] } @@ -414,7 +420,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -474,7 +481,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -534,7 +542,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -594,7 +603,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -654,7 +664,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -726,7 +737,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -786,7 +798,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -825,7 +838,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -885,7 +899,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -957,7 +972,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1033,7 +1049,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1108,7 +1125,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1168,7 +1186,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1228,7 +1247,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1288,7 +1308,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1344,7 +1365,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1399,7 +1421,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v14_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v14_UTF8.json index 779e7ec2c5ba8..60ff6857aca69 100644 --- a/postgres/tests/fixtures/schema_snapshot_v14_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v14_UTF8.json @@ -50,7 +50,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -89,7 +90,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -150,7 +152,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16730" + "toast_table": "pg_toast_16730", + "relkind": "r" } ] } @@ -211,7 +214,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16748" + "toast_table": "pg_toast_16748", + "relkind": "r" } ] } @@ -272,7 +276,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16725" + "toast_table": "pg_toast_16725", + "relkind": "r" } ] } @@ -333,7 +338,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16680" + "toast_table": "pg_toast_16680", + "relkind": "r" } ] } @@ -394,7 +400,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16705" + "toast_table": "pg_toast_16705", + "relkind": "r" } ] } @@ -455,7 +462,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16685" + "toast_table": "pg_toast_16685", + "relkind": "r" } ] } @@ -527,7 +535,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -604,7 +613,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16740" + "toast_table": "pg_toast_16740", + "relkind": "r" } ] } @@ -680,7 +690,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16715" + "toast_table": "pg_toast_16715", + "relkind": "r" } ] } @@ -751,7 +762,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16655" + "toast_table": "pg_toast_16655", + "relkind": "r" } ] } @@ -812,7 +824,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16700" + "toast_table": "pg_toast_16700", + "relkind": "r" } ] } @@ -873,7 +886,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16690" + "toast_table": "pg_toast_16690", + "relkind": "r" } ] } @@ -929,7 +943,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -990,7 +1005,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16675" + "toast_table": "pg_toast_16675", + "relkind": "r" } ] } @@ -1051,7 +1067,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16755" + "toast_table": "pg_toast_16755", + "relkind": "r" } ] } @@ -1112,7 +1129,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16720" + "toast_table": "pg_toast_16720", + "relkind": "r" } ] } @@ -1179,7 +1197,8 @@ "table_id": "16663" } ], - "toast_table": "pg_toast_16663" + "toast_table": "pg_toast_16663", + "relkind": "r" } ] } @@ -1240,7 +1259,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16735" + "toast_table": "pg_toast_16735", + "relkind": "r" } ] } @@ -1301,7 +1321,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16695" + "toast_table": "pg_toast_16695", + "relkind": "r" } ] } @@ -1362,7 +1383,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16710" + "toast_table": "pg_toast_16710", + "relkind": "r" } ] } @@ -1418,7 +1440,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16762" + "toast_table": "pg_toast_16762", + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v15_C.json b/postgres/tests/fixtures/schema_snapshot_v15_C.json index d9486fa77f902..74865a673692e 100644 --- a/postgres/tests/fixtures/schema_snapshot_v15_C.json +++ b/postgres/tests/fixtures/schema_snapshot_v15_C.json @@ -53,7 +53,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -108,7 +109,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -168,7 +170,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -207,7 +210,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -267,7 +271,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -327,7 +332,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -393,7 +399,8 @@ "definition": "FOREIGN KEY (city) REFERENCES cities(city)", "table_id": "16661" } - ] + ], + "relkind": "r" } ] } @@ -449,7 +456,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -509,7 +517,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -569,7 +578,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -629,7 +639,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -689,7 +700,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -779,7 +791,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -839,7 +852,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -899,7 +913,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -959,7 +974,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1014,7 +1030,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1071,7 +1088,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1147,7 +1165,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1219,7 +1238,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1279,7 +1299,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1339,7 +1360,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1399,7 +1421,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v15_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v15_UTF8.json index c3ede649aa389..bc29ecd4eb269 100644 --- a/postgres/tests/fixtures/schema_snapshot_v15_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v15_UTF8.json @@ -54,7 +54,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16720" + "toast_table": "pg_toast_16720", + "relkind": "r" } ] } @@ -110,7 +111,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -171,7 +173,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16715" + "toast_table": "pg_toast_16715", + "relkind": "r" } ] } @@ -227,7 +230,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16762" + "toast_table": "pg_toast_16762", + "relkind": "r" } ] } @@ -288,7 +292,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16685" + "toast_table": "pg_toast_16685", + "relkind": "r" } ] } @@ -349,7 +354,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16735" + "toast_table": "pg_toast_16735", + "relkind": "r" } ] } @@ -410,7 +416,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16730" + "toast_table": "pg_toast_16730", + "relkind": "r" } ] } @@ -471,7 +478,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16705" + "toast_table": "pg_toast_16705", + "relkind": "r" } ] } @@ -532,7 +540,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16690" + "toast_table": "pg_toast_16690", + "relkind": "r" } ] } @@ -588,7 +597,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16655" + "toast_table": "pg_toast_16655", + "relkind": "r" } ] } @@ -664,7 +674,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16680" + "toast_table": "pg_toast_16680", + "relkind": "r" } ] } @@ -725,7 +736,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16710" + "toast_table": "pg_toast_16710", + "relkind": "r" } ] } @@ -797,7 +809,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -873,7 +886,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16755" + "toast_table": "pg_toast_16755", + "relkind": "r" } ] } @@ -934,7 +948,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16725" + "toast_table": "pg_toast_16725", + "relkind": "r" } ] } @@ -995,7 +1010,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16695" + "toast_table": "pg_toast_16695", + "relkind": "r" } ] } @@ -1062,7 +1078,8 @@ "table_id": "16663" } ], - "toast_table": "pg_toast_16663" + "toast_table": "pg_toast_16663", + "relkind": "r" } ] } @@ -1101,7 +1118,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -1158,7 +1176,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1219,7 +1238,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16700" + "toast_table": "pg_toast_16700", + "relkind": "r" } ] } @@ -1280,7 +1300,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16748" + "toast_table": "pg_toast_16748", + "relkind": "r" } ] } @@ -1357,7 +1378,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16740" + "toast_table": "pg_toast_16740", + "relkind": "r" } ] } @@ -1418,7 +1440,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16675" + "toast_table": "pg_toast_16675", + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v16_C.json b/postgres/tests/fixtures/schema_snapshot_v16_C.json index 042e55a2439bf..c95f76ca09e2a 100644 --- a/postgres/tests/fixtures/schema_snapshot_v16_C.json +++ b/postgres/tests/fixtures/schema_snapshot_v16_C.json @@ -53,7 +53,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -108,7 +109,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -168,7 +170,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -207,7 +210,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -267,7 +271,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -327,7 +332,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -393,7 +399,8 @@ "definition": "FOREIGN KEY (city) REFERENCES cities(city)", "table_id": "16661" } - ] + ], + "relkind": "r" } ] } @@ -449,7 +456,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -509,7 +517,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -569,7 +578,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -629,7 +639,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -689,7 +700,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -764,7 +776,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -824,7 +837,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -884,7 +898,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -944,7 +959,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -999,7 +1015,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1056,7 +1073,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1147,7 +1165,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1219,7 +1238,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1279,7 +1299,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1339,7 +1360,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1399,7 +1421,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v16_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v16_UTF8.json index 62f24de1ae5c0..6def22cb30aa8 100644 --- a/postgres/tests/fixtures/schema_snapshot_v16_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v16_UTF8.json @@ -54,7 +54,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16720" + "toast_table": "pg_toast_16720", + "relkind": "r" } ] } @@ -110,7 +111,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -171,7 +173,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16715" + "toast_table": "pg_toast_16715", + "relkind": "r" } ] } @@ -227,7 +230,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16762" + "toast_table": "pg_toast_16762", + "relkind": "r" } ] } @@ -288,7 +292,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16685" + "toast_table": "pg_toast_16685", + "relkind": "r" } ] } @@ -349,7 +354,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16735" + "toast_table": "pg_toast_16735", + "relkind": "r" } ] } @@ -410,7 +416,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16730" + "toast_table": "pg_toast_16730", + "relkind": "r" } ] } @@ -471,7 +478,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16705" + "toast_table": "pg_toast_16705", + "relkind": "r" } ] } @@ -532,7 +540,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16690" + "toast_table": "pg_toast_16690", + "relkind": "r" } ] } @@ -588,7 +597,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16655" + "toast_table": "pg_toast_16655", + "relkind": "r" } ] } @@ -649,7 +659,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16680" + "toast_table": "pg_toast_16680", + "relkind": "r" } ] } @@ -710,7 +721,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16710" + "toast_table": "pg_toast_16710", + "relkind": "r" } ] } @@ -782,7 +794,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -858,7 +871,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16755" + "toast_table": "pg_toast_16755", + "relkind": "r" } ] } @@ -919,7 +933,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16725" + "toast_table": "pg_toast_16725", + "relkind": "r" } ] } @@ -980,7 +995,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16695" + "toast_table": "pg_toast_16695", + "relkind": "r" } ] } @@ -1047,7 +1063,8 @@ "table_id": "16663" } ], - "toast_table": "pg_toast_16663" + "toast_table": "pg_toast_16663", + "relkind": "r" } ] } @@ -1101,7 +1118,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -1158,7 +1176,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1219,7 +1238,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16700" + "toast_table": "pg_toast_16700", + "relkind": "r" } ] } @@ -1280,7 +1300,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16748" + "toast_table": "pg_toast_16748", + "relkind": "r" } ] } @@ -1357,7 +1378,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16740" + "toast_table": "pg_toast_16740", + "relkind": "r" } ] } @@ -1418,7 +1440,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16675" + "toast_table": "pg_toast_16675", + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v17_C.json b/postgres/tests/fixtures/schema_snapshot_v17_C.json index 950761d74e348..9d8a14fe6f99a 100644 --- a/postgres/tests/fixtures/schema_snapshot_v17_C.json +++ b/postgres/tests/fixtures/schema_snapshot_v17_C.json @@ -53,7 +53,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -108,7 +109,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -168,7 +170,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -207,7 +210,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -267,7 +271,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -327,7 +332,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -393,7 +399,8 @@ "definition": "FOREIGN KEY (city) REFERENCES cities(city)", "table_id": "16661" } - ] + ], + "relkind": "r" } ] } @@ -464,7 +471,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -524,7 +532,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -584,7 +593,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -644,7 +654,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -704,7 +715,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -779,7 +791,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -839,7 +852,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -899,7 +913,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -959,7 +974,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1014,7 +1030,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1071,7 +1088,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1147,7 +1165,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1219,7 +1238,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1279,7 +1299,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1339,7 +1360,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1399,7 +1421,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v17_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v17_UTF8.json index 0c9098d73a363..df181f9146918 100644 --- a/postgres/tests/fixtures/schema_snapshot_v17_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v17_UTF8.json @@ -54,7 +54,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16720" + "toast_table": "pg_toast_16720", + "relkind": "r" } ] } @@ -110,7 +111,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -171,7 +173,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16715" + "toast_table": "pg_toast_16715", + "relkind": "r" } ] } @@ -227,7 +230,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16762" + "toast_table": "pg_toast_16762", + "relkind": "r" } ] } @@ -288,7 +292,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16685" + "toast_table": "pg_toast_16685", + "relkind": "r" } ] } @@ -349,7 +354,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16735" + "toast_table": "pg_toast_16735", + "relkind": "r" } ] } @@ -425,7 +431,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16730" + "toast_table": "pg_toast_16730", + "relkind": "r" } ] } @@ -486,7 +493,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16705" + "toast_table": "pg_toast_16705", + "relkind": "r" } ] } @@ -547,7 +555,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16690" + "toast_table": "pg_toast_16690", + "relkind": "r" } ] } @@ -603,7 +612,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16655" + "toast_table": "pg_toast_16655", + "relkind": "r" } ] } @@ -664,7 +674,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16680" + "toast_table": "pg_toast_16680", + "relkind": "r" } ] } @@ -725,7 +736,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16710" + "toast_table": "pg_toast_16710", + "relkind": "r" } ] } @@ -797,7 +809,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -873,7 +886,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16755" + "toast_table": "pg_toast_16755", + "relkind": "r" } ] } @@ -934,7 +948,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16725" + "toast_table": "pg_toast_16725", + "relkind": "r" } ] } @@ -995,7 +1010,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16695" + "toast_table": "pg_toast_16695", + "relkind": "r" } ] } @@ -1062,7 +1078,8 @@ "table_id": "16663" } ], - "toast_table": "pg_toast_16663" + "toast_table": "pg_toast_16663", + "relkind": "r" } ] } @@ -1101,7 +1118,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -1158,7 +1176,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1219,7 +1238,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16700" + "toast_table": "pg_toast_16700", + "relkind": "r" } ] } @@ -1280,7 +1300,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16748" + "toast_table": "pg_toast_16748", + "relkind": "r" } ] } @@ -1357,7 +1378,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16740" + "toast_table": "pg_toast_16740", + "relkind": "r" } ] } @@ -1418,7 +1440,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16675" + "toast_table": "pg_toast_16675", + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v18_C.json b/postgres/tests/fixtures/schema_snapshot_v18_C.json index 56d3137e6030b..cb5f5bbdde2a3 100644 --- a/postgres/tests/fixtures/schema_snapshot_v18_C.json +++ b/postgres/tests/fixtures/schema_snapshot_v18_C.json @@ -53,7 +53,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -113,7 +114,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -173,7 +175,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -239,7 +242,8 @@ "definition": "FOREIGN KEY (city) REFERENCES cities(city)", "table_id": "16663" } - ] + ], + "relkind": "r" } ] } @@ -299,7 +303,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -359,7 +364,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -431,7 +437,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -491,7 +498,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -546,7 +554,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -621,7 +630,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -681,7 +691,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -753,7 +764,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -813,7 +825,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -873,7 +886,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -929,7 +943,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -968,7 +983,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -1028,7 +1044,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1088,7 +1105,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1164,7 +1182,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1224,7 +1243,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1279,7 +1299,8 @@ "is_partial": false } ], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1339,7 +1360,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } @@ -1399,7 +1421,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v18_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v18_UTF8.json index 301c781e7c8c7..ef8bd1cb836c6 100644 --- a/postgres/tests/fixtures/schema_snapshot_v18_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v18_UTF8.json @@ -54,7 +54,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16693" + "toast_table": "pg_toast_16693", + "relkind": "r" } ] } @@ -115,7 +116,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16708" + "toast_table": "pg_toast_16708", + "relkind": "r" } ] } @@ -176,7 +178,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16703" + "toast_table": "pg_toast_16703", + "relkind": "r" } ] } @@ -248,7 +251,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -309,7 +313,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16760" + "toast_table": "pg_toast_16760", + "relkind": "r" } ] } @@ -370,7 +375,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16728" + "toast_table": "pg_toast_16728", + "relkind": "r" } ] } @@ -426,7 +432,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16768" + "toast_table": "pg_toast_16768", + "relkind": "r" } ] } @@ -487,7 +494,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16738" + "toast_table": "pg_toast_16738", + "relkind": "r" } ] } @@ -548,7 +556,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16698" + "toast_table": "pg_toast_16698", + "relkind": "r" } ] } @@ -624,7 +633,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16678" + "toast_table": "pg_toast_16678", + "relkind": "r" } ] } @@ -701,7 +711,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16743" + "toast_table": "pg_toast_16743", + "relkind": "r" } ] } @@ -757,7 +768,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16656" + "toast_table": "pg_toast_16656", + "relkind": "r" } ] } @@ -796,7 +808,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -857,7 +870,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16752" + "toast_table": "pg_toast_16752", + "relkind": "r" } ] } @@ -918,7 +932,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16718" + "toast_table": "pg_toast_16718", + "relkind": "r" } ] } @@ -979,7 +994,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16713" + "toast_table": "pg_toast_16713", + "relkind": "r" } ] } @@ -1051,7 +1067,8 @@ ], "foreign_keys": [], "num_partitions": 2, - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1112,7 +1129,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16733" + "toast_table": "pg_toast_16733", + "relkind": "r" } ] } @@ -1173,7 +1191,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16723" + "toast_table": "pg_toast_16723", + "relkind": "r" } ] } @@ -1234,7 +1253,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16683" + "toast_table": "pg_toast_16683", + "relkind": "r" } ] } @@ -1290,7 +1310,8 @@ } ], "foreign_keys": [], - "partition_key": "RANGE (id)" + "partition_key": "RANGE (id)", + "relkind": "p" } ] } @@ -1351,7 +1372,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16688" + "toast_table": "pg_toast_16688", + "relkind": "r" } ] } @@ -1418,7 +1440,8 @@ "table_id": "16665" } ], - "toast_table": "pg_toast_16665" + "toast_table": "pg_toast_16665", + "relkind": "r" } ] } diff --git a/postgres/tests/fixtures/schema_snapshot_v9.6_UTF8.json b/postgres/tests/fixtures/schema_snapshot_v9.6_UTF8.json index 03729bc3a7ee1..a98b5db16a4e8 100644 --- a/postgres/tests/fixtures/schema_snapshot_v9.6_UTF8.json +++ b/postgres/tests/fixtures/schema_snapshot_v9.6_UTF8.json @@ -60,7 +60,8 @@ "table_id": "16644" } ], - "toast_table": "pg_toast_16644" + "toast_table": "pg_toast_16644", + "relkind": "r" } ] } @@ -121,7 +122,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16681" + "toast_table": "pg_toast_16681", + "relkind": "r" } ] } @@ -182,7 +184,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16693" + "toast_table": "pg_toast_16693", + "relkind": "r" } ] } @@ -243,7 +246,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16711" + "toast_table": "pg_toast_16711", + "relkind": "r" } ] } @@ -299,7 +303,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16762" + "toast_table": "pg_toast_16762", + "relkind": "r" } ] } @@ -360,7 +365,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16699" + "toast_table": "pg_toast_16699", + "relkind": "r" } ] } @@ -421,7 +427,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16723" + "toast_table": "pg_toast_16723", + "relkind": "r" } ] } @@ -513,7 +520,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16735" + "toast_table": "pg_toast_16735", + "relkind": "r" } ] } @@ -552,7 +560,8 @@ } ], "indexes": [], - "foreign_keys": [] + "foreign_keys": [], + "relkind": "f" } ] } @@ -613,7 +622,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16657" + "toast_table": "pg_toast_16657", + "relkind": "r" } ] } @@ -674,7 +684,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16717" + "toast_table": "pg_toast_16717", + "relkind": "r" } ] } @@ -735,7 +746,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16745" + "toast_table": "pg_toast_16745", + "relkind": "r" } ] } @@ -796,7 +808,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16669" + "toast_table": "pg_toast_16669", + "relkind": "r" } ] } @@ -867,7 +880,8 @@ } ], "foreign_keys": [], - "toast_table": "pg_toast_16634" + "toast_table": "pg_toast_16634", + "relkind": "r" } ] } @@ -928,7 +942,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16687" + "toast_table": "pg_toast_16687", + "relkind": "r" } ] } @@ -989,7 +1004,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16675" + "toast_table": "pg_toast_16675", + "relkind": "r" } ] } @@ -1050,7 +1066,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16729" + "toast_table": "pg_toast_16729", + "relkind": "r" } ] } @@ -1111,7 +1128,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16754" + "toast_table": "pg_toast_16754", + "relkind": "r" } ] } @@ -1172,7 +1190,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16705" + "toast_table": "pg_toast_16705", + "relkind": "r" } ] } @@ -1233,7 +1252,8 @@ ], "indexes": [], "foreign_keys": [], - "toast_table": "pg_toast_16663" + "toast_table": "pg_toast_16663", + "relkind": "r" } ] } diff --git a/postgres/tests/test_metadata.py b/postgres/tests/test_metadata.py index 4ea102b5d71d0..ae2523eda441b 100644 --- a/postgres/tests/test_metadata.py +++ b/postgres/tests/test_metadata.py @@ -183,6 +183,8 @@ def test_collect_schemas(integration_check, dbm_instance, aggregator, use_defaul assert table['name'] assert table['owner'] + assert 'relkind' in table + assert table['relkind'] in ('r', 'p', 'f') # make some assertions on fields if table['name'] == "persons":