: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(sql-editor): keep raw mode when opening managed queries (#75396)
Eric Duong62c446edc2d6
diff --git a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.test.ts b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.test.tsindex 193c255cb915..e1c64baeb8ac 100644--- a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.test.ts+++ b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.test.ts@@ -1599,6 +1599,25 @@ describe('sqlEditorLogic', () => {expect(logic.values.selectedConnectionSupportsHogQL).toEqual(true)expect(logic.values.sourceQuery.source.sendRawQuery).toEqual(true)expect(logic.values.sendRawQueryEnabled).toEqual(true)++ // The database sidebar opens a query through this URL without a raw hash param.+ // The connection stays the same, so the query-opening path must reapply the default.+ router.actions.push(+ urls.sqlEditor({+ query: 'SELECT * FROM managed_warehouse.events',+ connectionId: 'managed-conn-1',+ })+ )++ await expectLogic(logic).toDispatchActions(['setSourceQuery', 'createTab', 'updateTab'])++ expect(logic.values.sourceQuery.source.sendRawQuery).toEqual(true)+ expect(logic.values.sendRawQueryEnabled).toEqual(true)+ expect(String(router.values.hashParams.raw)).toEqual('1')++ logic.actions.setSendRawQuery(false)++ expect(logic.values.sendRawQueryEnabled).toEqual(false)})it('does not force raw SQL mode for a user-managed Postgres direct connection', async () => {diff --git a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsxindex 9ec71ce9b972..85eec132054e 100644--- a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx+++ b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx@@ -1814,6 +1814,10 @@ export const sqlEditorLogic = kea<sqlEditorLogicType>([actions.setQueryInput(insightVisualizationQuery.source.query || '')}+ // Opening another query can replace sourceQuery without changing the connection,+ // so the selectedConnectionId subscription does not run again.+ actions.enforceConnectionRawQueryMode()+// Focus the editor after creating a new tabprops.editor?.focus()},