Revision 9645
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/local.sh | ||
---|---|---|
44 | 44 |
psql() # usage: [file=...] [dir=...] self |
45 | 45 |
{ |
46 | 46 |
echo_func; kw_params file dir |
47 |
if test "$file"; then |
|
48 |
set -- --file "$file" "$@" |
|
49 |
local dir="${dir:-$(dirname "$file")}" |
|
50 |
fi |
|
47 |
if test "$file"; then local dir="${dir:-$(dirname "$file")}"; fi |
|
51 | 48 |
local dir="${dir:-$top_dir}" |
52 | 49 |
mk_schema_esc |
53 | 50 |
mk_table_esc |
... | ... | |
63 | 60 |
\set table_str '''$table_esc''' |
64 | 61 |
SET search_path TO $schema_esc, util; |
65 | 62 |
EOF |
66 |
cat)|cmd_log_fd=1 \
|
|
67 |
env no_search_path=1 "$psql_cmd" --output /dev/fd/13 "$@" |
|
63 |
cat${file:+ "$file"}
|
|
64 |
)|cmd_log_fd=1 env no_search_path=1 "$psql_cmd" --output /dev/fd/13 "$@"
|
|
68 | 65 |
# --output is for query *results*, not echoed statements |
69 | 66 |
} |
70 | 67 |
|
Also available in: Unified diff
bugfix: lib/sh/local.sh: psql(): $file can't both be passed as a --file param and be prefixed with the necessary \set schema, etc. commands, so instead include $file when cat-ing stdin