mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Fix more user-visible elog() calls.
Michael Paquier discovered that this could be triggered via SQL; give a nicer message instead. Patch by Michael Paquier, reviewed by Masahiko Sawada. Discussion: http://postgr.es/m/CAB7nPqQtPg+LKKtzdKN26judHcvPZ0s1gNigzOT4j8CYuuuBYg@mail.gmail.com
This commit is contained in:
parent
86076395ef
commit
9d742e19da
@ -26,7 +26,14 @@ SELECT pg_replication_origin_drop('test_decoding: temp');
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT pg_replication_origin_drop('test_decoding: temp');
|
SELECT pg_replication_origin_drop('test_decoding: temp');
|
||||||
ERROR: cache lookup failed for replication origin 'test_decoding: temp'
|
ERROR: replication origin "test_decoding: temp" does not exist
|
||||||
|
-- various failure checks for undefined slots
|
||||||
|
select pg_replication_origin_advance('test_decoding: temp', '0/1');
|
||||||
|
ERROR: replication origin "test_decoding: temp" does not exist
|
||||||
|
select pg_replication_origin_session_setup('test_decoding: temp');
|
||||||
|
ERROR: replication origin "test_decoding: temp" does not exist
|
||||||
|
select pg_replication_origin_progress('test_decoding: temp', true);
|
||||||
|
ERROR: replication origin "test_decoding: temp" does not exist
|
||||||
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
|
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
|
||||||
?column?
|
?column?
|
||||||
----------
|
----------
|
||||||
|
@ -13,6 +13,11 @@ SELECT pg_replication_origin_create('test_decoding: temp');
|
|||||||
SELECT pg_replication_origin_drop('test_decoding: temp');
|
SELECT pg_replication_origin_drop('test_decoding: temp');
|
||||||
SELECT pg_replication_origin_drop('test_decoding: temp');
|
SELECT pg_replication_origin_drop('test_decoding: temp');
|
||||||
|
|
||||||
|
-- various failure checks for undefined slots
|
||||||
|
select pg_replication_origin_advance('test_decoding: temp', '0/1');
|
||||||
|
select pg_replication_origin_session_setup('test_decoding: temp');
|
||||||
|
select pg_replication_origin_progress('test_decoding: temp', true);
|
||||||
|
|
||||||
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
|
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
|
||||||
|
|
||||||
-- origin tx
|
-- origin tx
|
||||||
|
@ -221,8 +221,10 @@ replorigin_by_name(char *roname, bool missing_ok)
|
|||||||
ReleaseSysCache(tuple);
|
ReleaseSysCache(tuple);
|
||||||
}
|
}
|
||||||
else if (!missing_ok)
|
else if (!missing_ok)
|
||||||
elog(ERROR, "cache lookup failed for replication origin '%s'",
|
ereport(ERROR,
|
||||||
roname);
|
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||||
|
errmsg("replication origin \"%s\" does not exist",
|
||||||
|
roname)));
|
||||||
|
|
||||||
return roident;
|
return roident;
|
||||||
}
|
}
|
||||||
@ -422,8 +424,10 @@ replorigin_by_oid(RepOriginId roident, bool missing_ok, char **roname)
|
|||||||
*roname = NULL;
|
*roname = NULL;
|
||||||
|
|
||||||
if (!missing_ok)
|
if (!missing_ok)
|
||||||
elog(ERROR, "cache lookup failed for replication origin with oid %u",
|
ereport(ERROR,
|
||||||
roident);
|
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||||
|
errmsg("replication origin with OID %u does not exist",
|
||||||
|
roident)));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user