Skip to content

Some questions about context handling #204

Answered by wesleykendall
stephan0h asked this question in Q&A
Discussion options

You must be logged in to vote
  1. No extra trips to the DB. This gets injected in the SQL itself in django DB connection hooks
  2. They are extremely fast queries to set variables (0.04MS for me locally). I'd recommend profiling the cost of set_config yourself if curious, i.e. explain analyze select set_config('variable.name', 'value', true);
  3. You're right that doing this on SELECTs is likely unnecessary. Wanna open a pull request? Any SQL that starts with SELECT should be able to be safely ignored, although there may be edge cases I'm not thinking about (multi-statement queries that get executed).

For 3, I can open a PR too, but it may be a week or more. It's this function where you can check the SQL statement and avoid inj…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@stephan0h
Comment options

Answer selected by wesleykendall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #203 on May 22, 2025 11:12.