Offering: openGaussDev

More detail: fixbug toast delete error

Match-id-7c3ae1b8af0a951caa93f58c00773f0fff3f40c9
This commit is contained in:
openGaussDev 2022-03-05 18:06:42 +08:00 committed by yanghao
parent 3affdfa80c
commit 79662644d8
2 changed files with 25 additions and 3 deletions

View File

@ -6027,9 +6027,7 @@ Datum fetch_lob_value_from_tuple(varatt_lob_pointer* lob_pointer, Oid update_oid
if (*is_null) {
new_attr = (Datum)0;
} else {
if (VARATT_IS_SHORT(attr) || VARATT_IS_EXTERNAL(attr) || VARATT_IS_4B(attr)) {
new_attr = PointerGetDatum(attr);
} else if (VARATT_IS_HUGE_TOAST_POINTER(attr)) {
if (VARATT_IS_HUGE_TOAST_POINTER(attr)) {
if (unlikely(origin_tuple->tupTableType == UHEAP_TUPLE)) {
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
@ -6040,6 +6038,8 @@ Datum fetch_lob_value_from_tuple(varatt_lob_pointer* lob_pointer, Oid update_oid
struct varlena *new_value = heap_tuple_fetch_and_copy(update_rel, old_value, false);
new_attr = PointerGetDatum(new_value);
heap_close(update_rel, NoLock);
} else if (VARATT_IS_SHORT(attr) || VARATT_IS_EXTERNAL(attr) || VARATT_IS_4B(attr)) {
new_attr = PointerGetDatum(attr);
} else {
ereport(ERROR, (errcode(ERRCODE_SYSTEM_ERROR),
errmsg("lob value which fetch from tuple type is not recognized."),

View File

@ -241,6 +241,28 @@ end;
call test_self_update();
create or replace procedure test_update_delete is
v1 clob;
begin
execute immediate 'select b from cloblongtbl where a=1' into v1;
update cloblongtbl set b=v1 where a=1;
rollback;
update cloblongtbl set b=v1 where a=2;
commit;
end;
/
call test_update_delete();
begin;
delete from cloblongtbl where a < 3;
rollback;
begin;
delete from cloblongtbl where a = 1;
delete from cloblongtbl where a = 2;
rollback;
drop table if exists cloblongtbl;
-- clean
drop schema if exists huge_clob cascade;