Add old includes
This commit is contained in:
39
helper/README.md
Normal file
39
helper/README.md
Normal file
@ -0,0 +1,39 @@
|
||||
# SQL-Helper-Files
|
||||
|
||||
PostgreSQL helper files for psql, for include via `\ir helper/....` in SQL files.
|
||||
|
||||
This helper files contains mostly command for setting permissions.
|
||||
|
||||
## Documentation, Usage
|
||||
|
||||
Common usage is to set some psql variables before include; some variables are usually global, others local for each call.
|
||||
|
||||
|
||||
### Global variables:
|
||||
|
||||
|
||||
```
|
||||
-- Name Value
|
||||
-- -------------------------------------------
|
||||
\set schema my_project
|
||||
\set db my_projectau
|
||||
|
||||
\set user_prefix my_project
|
||||
|
||||
\set owner :user_prefix _owner
|
||||
\set default_reader :user_prefix _reader
|
||||
\set default_updater :user_prefix _updater
|
||||
\set default_inserter :user_prefix _inserter
|
||||
```
|
||||
|
||||
|
||||
### Local variables
|
||||
|
||||
Usually you have to set `table` or `function` to the name of the current table or function. Grant scripts include call of revoke scripts!
|
||||
|
||||
```
|
||||
\set table last_created_table
|
||||
\ir helper/20-grant-default-reader.sql
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user