[{"data":1,"prerenderedAt":150},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fai-chat\u002Ffix-failed-query":3},{"id":4,"title":5,"body":6,"description":141,"extension":142,"meta":143,"navigation":144,"path":145,"redirect":146,"seo":147,"stem":148,"__hash__":149},"docs\u002Fdocs\u002Fai-chat\u002Ffix-failed-query.md","Fix a Failed Query",{"type":7,"value":8,"toc":134},"minimark",[9,13,22,27,44,52,58,78,83,87,95,99,113,117],[10,11,5],"h1",{"id":12},"fix-a-failed-query",[14,15,16,17,21],"p",{},"Use ",[18,19,20],"strong",{},"Fix with AI"," when a query in the SQL Console fails and you want a\ncorrected version without copying the query or error message into chat.",[23,24,26],"h2",{"id":25},"fix-the-error","Fix the error",[28,29,30,34],"ol",{},[31,32,33],"li",{},"Run the query in a SQL Console.",[31,35,36,37,40,41,43],{},"In the ",[18,38,39],{},"Query Error"," panel, click ",[18,42,20],{},".",[45,46],"img",{"className":47,"src":50,"alt":51},[48,49],"block","dark:hidden","\u002Fdocs\u002Fimages\u002Fgenerated\u002Ffix-failed-query-error-light.png","Query Error panel with the Fix with AI action",[45,53],{"className":54,"src":57,"alt":51},[55,56],"hidden","dark:block","\u002Fdocs\u002Fimages\u002Fgenerated\u002Ffix-failed-query-error-dark.png",[28,59,61,64],{"start":60},3,[31,62,63],{},"AI receives the failed query and the exact database error, checks the relevant\nschema, and writes a corrected query into the editor.",[31,65,66,67,70,71,74,75,43],{},"Review the highlighted SQL. Click ",[18,68,69],{},"Run"," to test it, then choose ",[18,72,73],{},"Keep"," or\n",[18,76,77],{},"Revert",[45,79],{"className":80,"src":81,"alt":82},[48,49],"\u002Fdocs\u002Fimages\u002Fgenerated\u002Ffix-failed-query-review-light.png","A corrected SQL query highlighted in the editor with Revert and Keep actions",[45,84],{"className":85,"src":86,"alt":82},[55,56],"\u002Fdocs\u002Fimages\u002Fgenerated\u002Ffix-failed-query-review-dark.png",[14,88,89,91,92,94],{},[18,90,73],{}," accepts the replacement. ",[18,93,77],{}," restores the query that failed.\nRunning the corrected query does not accept it automatically, so you can inspect\nthe result first.",[23,96,98],{"id":97},"if-the-fix-is-not-right","If the fix is not right",[14,100,101,102,104,105,110,111,43],{},"Click ",[18,103,77],{},", adjust the request yourself, or open ",[106,107,109],"a",{"href":108},"\u002Fdocs\u002Fai-chat","AI Chat","\nto discuss why the query failed. The original query remains available until you\nchoose ",[18,112,73],{},[23,114,116],{"id":115},"next","Next",[118,119,120,127],"ul",{},[31,121,122,126],{},[106,123,125],{"href":124},"\u002Fdocs\u002Fai-chat\u002Fgenerate-sql","Generate SQL"," — create a new query from plain language.",[31,128,129,133],{},[106,130,132],{"href":131},"\u002Fdocs\u002Fdatabase-explorer\u002Fsql-console","SQL Console"," — run and inspect queries.",{"title":135,"searchDepth":136,"depth":136,"links":137},"",2,[138,139,140],{"id":25,"depth":136,"text":26},{"id":97,"depth":136,"text":98},{"id":115,"depth":136,"text":116},"Use AI to repair a SQL error with the failed query and database error already attached, then review the replacement before keeping it.","md",{},false,"\u002Fdocs\u002Fai-chat\u002Ffix-failed-query",null,{"title":5,"description":141},"docs\u002Fai-chat\u002Ffix-failed-query","71aK8v94FWxPBc9sFzfdtGljeywhvXbWIXKU9VweE-I",1784670668682]