https://github.com/kmoppel/psql_magic
Conventions based "auto-complete" for "psql" (PostgreSQL command line client) for faster data-skimming
https://github.com/kmoppel/psql_magic
Last synced: 5 months ago
JSON representation
Conventions based "auto-complete" for "psql" (PostgreSQL command line client) for faster data-skimming
- Host: GitHub
- URL: https://github.com/kmoppel/psql_magic
- Owner: kmoppel
- Created: 2014-11-04T22:23:51.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-05-03T21:05:59.000Z (about 7 years ago)
- Last Synced: 2025-07-06T17:43:51.079Z (about 1 year ago)
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
psql_magic
==========
Conventions based "auto-complete" for "psql" (PostgreSQL command line client) for faster data-skimming.
Meant to be compiled against Postgres 9.5 currently (9.3 and 9.4 will work with commit 688b899ccd2a2ebce7a13a82c5ad6949ebd6e39d)
Usage
==========
```
postgres=# \*
psql_magic usage 1: "\* table_pattern [o|od|oa|oc|oca|ocd|om|oma|omd] [lX]"
table_pattern - "*" can be used for wildcards. full table names (with schema) will be searched
[o|od|oa|oc|oca|ocd|om|oma|omd] - optional order by clause
where:
[o]-> order by PK. sort direction determined by .psqlrc variable psql_magic_default_order_by_direction
[c|m] -> [created|modified]. column patterns defined by psql_magic_created_column_patterns variable
[a|d] -> [asc|desc]. column patterns defined by psql_magic_created_column_patterns variable
[lX] - optional "limit X" clause. if not specified default "limit" defined by psql_magic_default_row_limit wil be used
psql_magic usage 2: "\* table_pattern w[here] column_pattern column_value"
table_pattern - "*" can be used for wildcards. full table names (with schema) will be searched
column_pattern - "*" can be used for wildcards
column_value - quotes will be added automatically
```
Configuration
=============
Following variables are looked for from the `.psqlrc` config file:
```
\set PSQL_MAGIC_DEFAULT_ROW_LIMIT 2
\set PSQL_MAGIC_DEFAULT_ORDER_BY_DIRECTION 1
\set PSQL_MAGIC_CREATED_COLUMN_PATTERNS created,timestamp,time,mktime,mtime
\set PSQL_MAGIC_MODIFIED_COLUMN_PATTERNS modified,updated,timestamp,mtime
\set PSQL_MAGIC_USE_1ST_ON_DUPLICATE 1
```