Skip to content

Add support for security barrier and invoker#453

Open
calebhearth wants to merge 4 commits intomainfrom
refactor-with-options
Open

Add support for security barrier and invoker#453
calebhearth wants to merge 4 commits intomainfrom
refactor-with-options

Conversation

@calebhearth
Copy link
Contributor

@calebhearth calebhearth commented Nov 13, 2025

Postgres accepts arguments in the form WITH (<option>[ = <true|false>]), so
rather than manually extending the various APIs to accept them individually
let's take a with: {...} argument that can take in arbitrary values.

The argument handling is:

  • false or null values are discarded as the default behavior
  • true values are passed as <option> = true
  • other String or Symbol values are passed as <option> = <value>

This provides a more extensible API that can support any PostgreSQL view option
without requiring changes to Scenic's code, as evidence has shown that Derek and
I aren't super responsive maintainers. This should allow extensibility with new
Postgres (and other) features without requiring one of us to add support for
them.

A drawback and/or strength of this approach is that maintainers of Scenic
adapters such as MySQL or SQLite1 will have to deal with the
with hash individually, and that it may break migrations between databases. I
suspect that the latter is (a). unlikely to ever come up and (b). the least of the
worries of developers who undertake this.

  • Add parse_view_options helper to generically parse PostgreSQL reloptions

Conventional: Feat
Feat: Allow with argument to *_view to be passed to view DDL statements
Conventional: BREAKING CHANGE
Breaking: Users of the #433 fork will
need to adjust their arguments slightly.
Closes: #433
Closes: #432

Footnotes

  1. I just want to call out that "SQLite" is intended to be
    pronounced as rhyming with meteorite and not with blight because I think that's
    fun.

@calebhearth calebhearth force-pushed the refactor-with-options branch from 07acb6d to bf13464 Compare November 13, 2025 21:05
Postgres accepts arguments in the form `WITH (<option>[ = <true|false>])`, so
rather than manually extending the various APIs to accept them individually
let's take a `with: {...}` argument that can take in arbitrary values.

The argument handling is:

- `false` or `null` values are discarded as the default behavior
- `true` values are passed as `<option> = true`
- other String or Symbol values are passed as `<option> = <value>`

This provides a more extensible API that can support any PostgreSQL view option
without requiring changes to Scenic's code, as evidence has shown that Derek and
I aren't super responsive maintainers. This should allow extensibility with new
Postgres (and other) features without requiring one of us to add support for
them.

A drawback and/or strength of this approach is that maintainers of Scenic
adapters such as MySQL or SQLite[^pronunciation] will have to deal with the
`with` hash individually, and that it may break migrations between databases. I
suspect that the latter is (a). unlikely to ever come up and (b). the least of the
worries of developers who undertake this.

- Add parse_view_options helper to generically parse PostgreSQL reloptions

[^pronunciation]: I just want to call out that "SQLite" is intended to be
pronounced as rhyming with meteorite and not with blight because I think that's
fun.

Conventional: Feat
Feat: Allow `with` argument to *_view to be passed to view DDL statements
Conventional: BREAKING CHANGE
Breaking: Users of the #433 fork will
          need to adjust their arguments slightly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for create view options (security_invoker, etc)

3 participants