Revision 12800
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/lib/runscripts/table.run | ||
---|---|---|
31 | 31 |
table_make_install() |
32 | 32 |
{ |
33 | 33 |
echo_func |
34 |
prep_try; if ! remaking && pg_table_exists; then rethrow; return 0; fi |
|
35 |
rethrow |
|
34 |
if ! remaking && pg_table_exists; then return 0; fi |
|
36 | 35 |
local install_log="${install_log-$top_dir/$install_log_rel}" |
37 | 36 |
local verbosity_min= # install logs require default verbosity |
38 | 37 |
if ! remaking && test -e "$install_log"; then local_export noclobber=1; fi |
trunk/lib/sh/local.sh | ||
---|---|---|
82 | 82 |
)|psql__db_sh "$@" |
83 | 83 |
} |
84 | 84 |
|
85 |
public_schema_exists() # usage: prep_try; if public_schema_exists; \ |
|
86 |
# then rethrow; ...; fi; rethrow |
|
87 |
# OR prep_try; public_schema_exists || { rethrow; ...; }; rethrow |
|
88 |
{ echo_func; schema=public clog++ pg_schema_exists; } |
|
85 |
public_schema_exists() { echo_func; schema=public clog++ pg_schema_exists; } |
|
89 | 86 |
|
90 | 87 |
pg_dump_local() { echo_func; use_local; pg_dump "$@"; } |
91 | 88 |
|
trunk/lib/sh/db.sh | ||
---|---|---|
362 | 362 |
) |
363 | 363 |
} |
364 | 364 |
|
365 |
pg_schema_exists() # usage: prep_try; if schema=... pg_schema_exists; \ |
|
366 |
# then rethrow; ...; fi; rethrow |
|
367 |
# OR prep_try; schema=... pg_schema_exists || { rethrow; ...; }; rethrow |
|
365 |
pg_schema_exists() # usage: schema=... pg_schema_exists |
|
368 | 366 |
{ |
369 | 367 |
echo_func; : "${schema:?}"; mk_schema_esc |
370 |
prep_try; pattern='cannot create temporary relation in non-temporary schema' \
|
|
368 |
pattern='cannot create temporary relation in non-temporary schema' \ |
|
371 | 369 |
ignore_e=3 stderr_matches psql <<<"CREATE TEMP TABLE $schema_esc.t ()" |
372 | 370 |
} |
373 | 371 |
|
... | ... | |
377 | 375 |
clog++ pg_schema_exists || die "schema $schema does not exist" |
378 | 376 |
} |
379 | 377 |
|
380 |
pg_table_exists() # usage: prep_try; if [schema=...] table=... pg_table_exists; \ |
|
381 |
# then rethrow; ...; fi; rethrow |
|
382 |
# OR prep_try; table=... pg_table_exists || { rethrow; ...; }; rethrow |
|
378 |
pg_table_exists() # usage: [schema=...] table=... pg_table_exists |
|
383 | 379 |
{ |
384 | 380 |
echo_func; : "${table:?}"; mk_table_esc |
385 |
prep_try; pattern='relation .* does not exist' \
|
|
381 |
pattern='relation .* does not exist' \ |
|
386 | 382 |
ignore_e=3 stderr_matches psql <<<"SELECT NULL FROM $table_esc LIMIT 0" |
387 | 383 |
} |
388 | 384 |
|
Also available in: Unified diff
*{.sh,run}: stderr_matches() wrapper calls: removed no longer needed prep_try/rethrow