Fix show error core and update user core.

This commit is contained in:
totaj
2022-12-02 17:00:48 +08:00
parent b3e8d8ff5a
commit 3a07b35cee
4 changed files with 66 additions and 6 deletions

View File

@ -3928,7 +3928,7 @@ static Query* transformUpdateStmt(ParseState* pstate, UpdateStmt* stmt)
}
/* non-supported IGNORE cases */
Relation rel = ((Relation)linitial(pstate->p_target_relation));
Relation rel = ((Relation)linitial2(pstate->p_target_relation));
if (pstate->p_has_ignore && rel != NULL) {
if (RelationIsColumnFormat(rel)) {
ereport(ERROR, ((errcode(ERRCODE_FEATURE_NOT_SUPPORTED),

View File

@ -5369,14 +5369,13 @@ void gramShowWarningsErrors(int offset, int count, DestReceiver *dest, bool isSh
Assert(lc != NULL);
DolphinErrorData *eData = (DolphinErrorData *)lfirst(lc);
values[1] = Int32GetDatum(eData->errorcode);
if (eData->message) {
values[2] = CStringGetTextDatum(eData->message);
} else {
values[2] = CStringGetTextDatum("");
}
if (isShowErrors) {
if (eData->elevel == enum_dolphin_error_level::B_ERROR) {
values[0] = CStringGetTextDatum("Error");
} else {
currIdx++;
continue;
}
} else {
switch (eData->elevel) {
@ -5392,6 +5391,12 @@ void gramShowWarningsErrors(int offset, int count, DestReceiver *dest, bool isSh
break;
}
}
if (eData->message) {
values[2] = CStringGetTextDatum(eData->message);
} else {
values[2] = CStringGetTextDatum("");
}
limit--;
currIdx++;
do_tup_output(tstate, values, NUM_SHOW_WARNINGS_COLUMNS, nulls, NUM_SHOW_WARNINGS_COLUMNS);

View File

@ -69,6 +69,46 @@ show warnings;
Note | 0 | TEST CHAR VALUE IS abc
(1 row)
drop table if exists t_showtest;
NOTICE: table "t_showtest" does not exist, skipping
create table t_showtest(a int, primary key(a));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t_showtest_pkey" for table "t_showtest"
show errors;
level | code | message
-------+------+---------
(0 rows)
show errors limit 10;
level | code | message
-------+------+---------
(0 rows)
drop table if exists t_showtest;
create table t_showtest(a int, primary key(a));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t_showtest_pkey" for table "t_showtest"
show warnings;
level | code | message
-------+------+------------------------------------------------------------------------------------------------
Note | 0 | CREATE TABLE / PRIMARY KEY will create implicit index "t_showtest_pkey" for table "t_showtest"
(1 row)
drop table if exists t_showtest;
update user set b = 'x' where a = 1;
ERROR: column "a" does not exist
LINE 1: update user set b = 'x' where a = 1;
^
show warnings;
level | code | message
-------+----------+---------------------------
Error | 50360452 | column "a" does not exist
(1 row)
show errors;
level | code | message
-------+----------+---------------------------
Error | 50360452 | column "a" does not exist
(1 row)
set sql_note=false;
select TEST_FUNC('abc'::clob);
INFO: TEST CHAR VALUE IS abc

View File

@ -22,6 +22,21 @@ $$ LANGUAGE plpgsql;
select TEST_FUNC('abc'::clob);
show warnings;
drop table if exists t_showtest;
create table t_showtest(a int, primary key(a));
show errors;
show errors limit 10;
drop table if exists t_showtest;
create table t_showtest(a int, primary key(a));
show warnings;
drop table if exists t_showtest;
update user set b = 'x' where a = 1;
show warnings;
show errors;
set sql_note=false;
select TEST_FUNC('abc'::clob);
show warnings;