Project

General

Profile

« Previous | Next » 

Revision 10764

lib/sh/db.sh: added pg_dump(), using the code in bin/pg_dump_vegbien with clarity improvements

View differences:

lib/sh/db.sh
311 311
pg_export_table_no_header "$@"
312 312
}
313 313

  
314
pg_dump() # usage: [schema=...] [struct=1 | data=1] [compress=1] [owners=1] \
315
# pg_dump [opts...] >out
316
{
317
	echo_func; kw_params struct data plain owners; local struct="${struct-1}"
318
	
319
	# subset
320
	if test "$schema"; then set -- --schema="\"$schema\"" "$@"; fi
321
	
322
	# format
323
	if test "$compress"; then set -- "$@" --format=c --compress=9
324
	                     else set -- "$@" --format=p --inserts # plain
325
	fi
326
	if test "$struct"  ; then set -- "$@" --schema-only; fi
327
	if test "$data"    ; then set -- "$@" --data-only  ; fi
328
	if test ! "$owners"; then set -- "$@" --no-owner   ; fi
329
	
330
	pg_cmd "$@"
331
}
332

  
314 333
fi

Also available in: Unified diff