Revision 8807
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/util.sh | ||
---|---|---|
170 | 170 |
fi |
171 | 171 |
: "${pg_copy_format=CSV HEADER}" |
172 | 172 |
|
173 |
psql <<<"COPY $source TO STDOUT $pg_copy_format;" |
|
173 |
psql "$@" <<<"COPY $source TO STDOUT $pg_copy_format;"
|
|
174 | 174 |
} |
175 | 175 |
|
176 | 176 |
pg_header () |
177 | 177 |
{ |
178 | 178 |
echo_func "$@" |
179 | 179 |
local pg_copy_format="CSV HEADER" limit=0 |
180 |
pg_copy_to|echo_stdin |
|
180 |
pg_copy_to "$@"|echo_stdin
|
|
181 | 181 |
} |
182 | 182 |
|
183 | 183 |
pg_export_table_no_header () |
184 | 184 |
{ |
185 | 185 |
echo_func "$@" |
186 | 186 |
local pg_copy_format="CSV" |
187 |
pg_copy_to |
|
187 |
pg_copy_to "$@"
|
|
188 | 188 |
} |
189 | 189 |
|
190 | 190 |
pg_export_table_to_dir_no_header () |
191 | 191 |
{ |
192 | 192 |
echo_func "$@" |
193 | 193 |
local table="$1"; shift; mk_table_esc |
194 |
local cols="$(pg_header "$table")"
|
|
194 |
local cols="$(pg_header)" |
|
195 | 195 |
pg_export_table_no_header "$@" >"$exports_dir/$table.no_header.cols=$cols.csv" |
196 | 196 |
} |
197 | 197 |
|
Also available in: Unified diff
lib/util.sh: pg_* (): pass "$@" to invoked functions since it may contain psql connection or config info