Project

General

Profile

« Previous | Next » 

Revision 9650

lib/sh/local.sh: psql(): use new psql() from db.sh instead of psql_script_vegbien/psql_verbose_vegbien. this requires setting local_pg_database=vegbien to replace vegbien_dest used by psql_*_vegbien.

View differences:

lib/sh/local.sh
22 22
: "${local_server=localhost}"
23 23
: "${local_user=bien}"
24 24
: "${local_password="$(cat "$root_dir"/config/bien_password)"}"
25
: "${local_pg_database=vegbien}"
25 26
: "${root_user=root}"
26 27
: "${root_password=$local_password}"
27 28

  
......
41 42

  
42 43
### PostgreSQL
43 44

  
45
func_override psql__db_sh
44 46
psql() # usage: [file=...] [dir=...] self
45 47
{
46 48
	echo_func; kw_params file dir
......
49 51
	mk_schema_esc
50 52
	mk_table_esc
51 53
	
52
	local psql_cmd="psql_$(if can_log; then echo verbose; else echo script; fi)_vegbien"
53
	local redirs=("${redirs[@]}" '13>&1') # not 11 because it gives a
54
		# "/dev/fd/11: Bad file descriptor" error when 11 is set with exec
55
		# right before the command instead of on the subshell it's executed in
54
	use_local
56 55
	(cat <<EOF
57 56
\cd $dir
58 57
\set schema $schema_esc
......
61 60
SET search_path TO $schema_esc, util;
62 61
EOF
63 62
	cat${file:+ "$file"}
64
	)|cmd_log_fd=1 env no_search_path=1 "$psql_cmd" --output /dev/fd/13 "$@"
65
		# --output is for query *results*, not echoed statements
63
	)|psql__db_sh "$@"
66 64
}
67 65

  
68 66
public_schema_exists() { psql_script_vegbien </dev/null 2>/dev/null; }

Also available in: Unified diff