Project

General

Profile

« Previous | Next » 

Revision 13351

bugfix: lib/sh/db.sh: pg_schema_exists(): also need to benignify "does not exist" error if returns false

View differences:

trunk/lib/sh/db.sh
398 398

  
399 399
## DB structure
400 400

  
401
benign_does_not_exist_error() # usage: type=what benign_does_not_exist_error cmd
402
{
403
	log-- echo_func; : "${type:?}"
404
	pattern="$type .* does not exist" ignore_e=3 ignore_err_msg "$@"
405
}
406

  
401 407
pg_schema_exists() # usage: schema=__ [benign_error=1] pg_schema_exists
402 408
{
403 409
	log-- echo_func; : "${schema:?}"; mk_schema_esc
410
	# produces error both if true and if false
404 411
	pattern='cannot create temporary relation in non-temporary schema' \
405
ignore_e=3 stderr_matches psql <<<"CREATE TEMP TABLE $schema_esc.t ()"
412
ignore_e=3 type=schema stderr_matches benign_does_not_exist_error \
413
psql <<<"CREATE TEMP TABLE $schema_esc.t ()"
406 414
}
407 415

  
408 416
public_schema_exists() { log-- echo_func; schema=public pg_schema_exists; }

Also available in: Unified diff