Revision 9088
Added by Aaron Marcuse-Kubitza over 11 years ago
db.sh | ||
---|---|---|
17 | 17 |
alias mk_schema_esc='declare schema_esc; mk_esc_name schema' |
18 | 18 |
alias mk_table_esc='declare table_esc; mk_esc_name table' |
19 | 19 |
|
20 |
alias mk_select='mk_table_esc |
|
21 |
declare query="${query:-SELECT * FROM $table_esc}${limit:+ LIMIT $limit}"' |
|
22 |
|
|
20 | 23 |
fi # load new aliases |
21 | 24 |
if self_being_included; then |
22 | 25 |
|
... | ... | |
70 | 73 |
pg_export() |
71 | 74 |
{ |
72 | 75 |
echo_func |
73 |
mk_table_esc |
|
74 |
local query="${query:-SELECT * FROM $table_esc}${limit:+ LIMIT $limit}" |
|
76 |
mk_select |
|
75 | 77 |
local pg_copy_format="${pg_copy_format-CSV HEADER}" |
76 | 78 |
|
77 | 79 |
psql "$@" <<<"COPY ($query) TO STDOUT $pg_copy_format;" |
Also available in: Unified diff
lib/sh/db.sh: added mk_select alias and use it in pg_export()