Project

General

Profile

« Previous | Next » 

Revision 12806

lib/sh/db.sh: pg_*_exists(): log the DB statements to check this at a higher log_level so that they don't clutter up the log output

View differences:

trunk/lib/sh/db.sh
366 366
{
367 367
	echo_func; : "${schema:?}"; mk_schema_esc
368 368
	pattern='cannot create temporary relation in non-temporary schema' \
369
ignore_e=3 stderr_matches psql <<<"CREATE TEMP TABLE $schema_esc.t ()"
369
ignore_e=3 clog++ stderr_matches psql <<<"CREATE TEMP TABLE $schema_esc.t ()"
370 370
}
371 371

  
372 372
pg_require_schema() # usage: schema=... pg_require_schema
373 373
{
374 374
	echo_func; : "${schema:?}"
375
	clog++ pg_schema_exists || die "schema $schema does not exist"
375
	pg_schema_exists || die "schema $schema does not exist"
376 376
}
377 377

  
378 378
pg_table_exists() # usage: [schema=...] table=... pg_table_exists
379 379
{
380 380
	echo_func; : "${table:?}"; mk_table_esc
381 381
	pattern='relation .* does not exist' \
382
ignore_e=3 stderr_matches psql <<<"SELECT NULL FROM $table_esc LIMIT 0"
382
ignore_e=3 clog++ stderr_matches psql <<<"SELECT NULL FROM $table_esc LIMIT 0"
383 383
}
384 384

  
385 385
fi

Also available in: Unified diff