Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(hogql): correct catalog column descriptions that contradict the code (#84278)

Sam Penningtonc4c98b907701
diff --git a/posthog/hogql/database/schema/heatmaps.py b/posthog/hogql/database/schema/heatmaps.py
index 05703d5df40a..b64d0f763295 100644
--- a/posthog/hogql/database/schema/heatmaps.py
+++ b/posthog/hogql/database/schema/heatmaps.py
@@ -37,10 +37,14 @@ class HeatmapsTable(Table):
name="scale_factor", nullable=False, description="Grid resolution applied to `x`/`y` coordinates."
),
"viewport_width": IntegerDatabaseField(
- name="viewport_width", nullable=False, description="Browser viewport width at capture time, in pixels."
+ name="viewport_width",
+ nullable=False,
+ description="Viewport width at capture time, stored scaled down like `x`; multiply by `scale_factor` for CSS pixels.",
),
"viewport_height": IntegerDatabaseField(
- name="viewport_height", nullable=False, description="Browser viewport height at capture time, in pixels."
+ name="viewport_height",
+ nullable=False,
+ description="Viewport height at capture time, stored scaled down like `y`; multiply by `scale_factor` for CSS pixels.",
),
"pointer_target_fixed": BooleanDatabaseField(
name="pointer_target_fixed",
diff --git a/posthog/hogql/database/schema/system.py b/posthog/hogql/database/schema/system.py
index 0695f8f33ad4..5a455c0829de 100644
--- a/posthog/hogql/database/schema/system.py
+++ b/posthog/hogql/database/schema/system.py
@@ -291,7 +291,9 @@ alerts: PostgresTable = PostgresTable(
name="insight_id", description="Insight the alert watches; joins to insights.id."
),
"enabled": BooleanDatabaseField(name="enabled", description="Whether the alert is active."),
- "state": StringDatabaseField(name="state", description="Current alert state, e.g. 'firing' or 'not_firing'."),
+ "state": StringDatabaseField(
+ name="state", description="Current alert state: 'Firing', 'Not firing', 'Errored', or 'Snoozed'."
+ ),
"calculation_interval": StringDatabaseField(
name="calculation_interval", description="How often the alert is evaluated, e.g. 'daily'."
),
@@ -690,7 +692,8 @@ data_warehouse_sources: PostgresTable = PostgresTable(
name="source_type", description="Source connector type, e.g. 'Stripe', 'Postgres', 'Hubspot'."
),
"status": StringDatabaseField(
- name="status", description="Latest source-level status, e.g. Running, Paused, Error, Completed."
+ name="status",
+ description="Legacy source-level status, deprecated in favour of per-schema status in source_schemas.status; may be stale.",
),
"access_method": StringDatabaseField(
name="access_method",
@@ -924,7 +927,7 @@ endpoint_versions: PostgresTable = PostgresTable(
"is_active": ExpressionField(
name="is_active",
expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_active"])]),
- description="1 if this is the currently served version, 0 otherwise.",
+ description="1 if this version can be executed, 0 if inactive; independent of the endpoint's current_version.",
),
"columns": StringJSONDatabaseField(name="columns", description="JSON schema of the version's output columns."),
},
@@ -1407,7 +1410,8 @@ annotations: PostgresTable = PostgresTable(
"team_id": IntegerDatabaseField(name="team_id"),
"content": StringDatabaseField(name="content", nullable=True, description="Annotation text."),
"scope": StringDatabaseField(
- name="scope", description="Where the annotation applies, e.g. 'project', 'dashboard', 'insight'."
+ name="scope",
+ description="Where the annotation applies: 'project', 'organization', 'dashboard', 'dashboard_item' (insight), or 'recording'.",
),
"creation_type": StringDatabaseField(
name="creation_type", description="How the annotation was created, e.g. user-created vs GitHub."
@@ -1647,7 +1651,8 @@ notebooks: PostgresTable = PostgresTable(
description="1 if the notebook has been deleted, 0 otherwise.",
),
"visibility": StringDatabaseField(
- name="visibility", description="Visibility setting, e.g. 'private' or shared."
+ name="visibility",
+ description="Visibility: 'default' (normal notebook) or 'internal' (system-generated, hidden from the main list).",
),
"version": IntegerDatabaseField(name="version", description="Notebook version number."),
"created_by_id": IntegerDatabaseField(
@@ -2199,7 +2204,9 @@ support_tickets: PostgresTable = PostgresTable(
"distinct_id": StringDatabaseField(
name="distinct_id", description="Distinct id of the person who opened the ticket."
),
- "status": StringDatabaseField(name="status", description="Ticket status, e.g. 'open', 'pending', 'closed'."),
+ "status": StringDatabaseField(
+ name="status", description="Ticket status: 'new', 'open', 'pending', 'on_hold', or 'resolved'."
+ ),
"priority": StringDatabaseField(
name="priority", nullable=True, description="Ticket priority, e.g. 'low', 'high'."
),
@@ -2520,12 +2527,11 @@ usage_metrics: PostgresTable = PostgresTable(
"id": StringDatabaseField(name="id", description="Usage metric UUID."),
"team_id": IntegerDatabaseField(name="team_id"),
"group_type_index": IntegerDatabaseField(
- name="group_type_index", description="Group type the metric applies to (0-4)."
+ name="group_type_index",
+ description="Legacy; the query runner ignores it and evaluates every metric regardless. Don't filter on it.",
),
"name": StringDatabaseField(name="name", description="Metric name."),
- "format": StringDatabaseField(
- name="format", description="Display format, e.g. 'numeric', 'currency', 'percentage'."
- ),
+ "format": StringDatabaseField(name="format", description="Display format: 'numeric' or 'currency'."),
"interval": IntegerDatabaseField(
name="interval", description="Rolling window length, in days, the metric is computed over."
),
@@ -2533,9 +2539,12 @@ usage_metrics: PostgresTable = PostgresTable(
name="display", description="How the metric is visualized, e.g. 'number' or 'sparkline'."
),
"filters": StringJSONDatabaseField(
- name="filters", description="JSON event filters defining what the metric counts."
+ name="filters",
+ description='JSON event/action filters ({"events": [...], "actions": [...], "properties": [...]}) or data warehouse filters ({"source": "data_warehouse", "table_name": "...", "timestamp_field": "...", "key_field": "..."}).',
+ ),
+ "math": StringDatabaseField(
+ name="math", description="Aggregation: 'count' or 'sum'; 'sum' aggregates math_property."
),
- "math": StringDatabaseField(name="math", description="Aggregation applied, e.g. 'total', 'unique', 'sum'."),
"math_property": StringDatabaseField(
name="math_property",
nullable=True,
diff --git a/products/customer_analytics/backend/facade/hogql.py b/products/customer_analytics/backend/facade/hogql.py
index b369b83e1ebf..63c9cc7a3352 100644
--- a/products/customer_analytics/backend/facade/hogql.py
+++ b/products/customer_analytics/backend/facade/hogql.py
@@ -1329,7 +1329,7 @@ custom_property_definitions: PostgresTable = PostgresTable(
),
"display_type": StringDatabaseField(
name="display_type",
- description="How the property is interpreted and rendered: 'text', 'number', 'currency', 'percent', 'date', 'datetime', or 'boolean'.",
+ description="How the property is interpreted and rendered: 'text', 'number', 'currency', 'percent', 'date', 'datetime', 'boolean', 'select' (allowed options stored on the definition), or 'link'.",
),
"_is_big_number": BooleanDatabaseField(name="is_big_number", hidden=True),
"is_big_number": ExpressionField(