Software Engineering · Poland
Poland’s first PGConf put AI-written SQL on the agenda. Who checks the query?
A Gdańsk conference offers a practical starting point for building AI-assisted analytics without giving a model unrestricted database access.
By Launchr Space ·
At the first PGConf.PL in Gdańsk on November 24, the agenda put a question from product teams right next to the usual database engineering work: can AI write SQL? The organizers scheduled Bruce Momjian’s talk on precisely that, as well as sessions on governance and multi-tenant database design. This was a conference agenda, not a new PostgreSQL feature announcement. Its useful prompt for builders is narrower: what should stand between a generated query and customer data?
Fix the meaning before generating the query
Start with one reporting workflow where you can name every allowed metric. In a sales dashboard, for example, decide whether revenue means booked orders, settled payments, or settlements minus refunds. Document which time zone closes the month. Put those definitions in a curated reporting view or metric layer and use them in the analyst’s existing dashboard as well. If the answer differs from the dashboard, the team can trace a mismatch against the same definitions instead of arguing over which chart looks right.
Have the model produce a proposed query and a short explanation of the data it expects to use. For a first rollout, keep execution on an isolated reporting environment where possible, grant a narrowly scoped read-only role, and independently enforce the dataset and tenant boundary. A read-only credential alone does not make a broad query safe or cheap. Limit query time and result size, and use a review step for new or unusually expensive query shapes.
Grade the answer, not just the SQL
Create a small set of queries with answers an analyst has already verified. Include refunds, empty periods, month boundaries, and data from two tenants. Then test paraphrases of the same request. A query can execute perfectly while grouping the wrong records or counting a refunded order twice. Track correctness and cost separately; a fast wrong answer still fails.
Finally, give the user the filters and date range next to the result. A person who asks for revenue last month should see what the system counted without reading SQL. If the approved dataset cannot answer a question, report the gap instead of assembling a plausible-looking number. The product promise is a result that can be checked, not a query that looks impressive.