Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc4f7a6b

Browse files
committed
Refactor one conversion of SQLSTATE to string in elog.c
unpack_sql_state() has been introduced ind46bc44 to refactor theunpacking of a SQLSTATE into a string, but it forgot one code path whensending error reports to clients that could make use of it. Thischanges the code to also use unpack_sql_state() there, simplifying a bitthe code.Author: Peter SmithDiscussion:https://postgr.es/m/CAHut+PuYituuD1-VVZUNcmCQuc3ZzZMPoO57POgm8tnXOkwJAA@mail.gmail.com
1 parentde1d4fe commitc4f7a6b

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

‎src/backend/utils/error/elog.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3312,8 +3312,6 @@ send_message_to_frontend(ErrorData *edata)
33123312
/* New style with separate fields */
33133313
constchar*sev;
33143314
chartbuf[12];
3315-
intssval;
3316-
inti;
33173315

33183316
/* 'N' (Notice) is for nonfatal conditions, 'E' is for errors */
33193317
pq_beginmessage(&msgbuf, (edata->elevel<ERROR) ?'N' :'E');
@@ -3324,17 +3322,8 @@ send_message_to_frontend(ErrorData *edata)
33243322
pq_sendbyte(&msgbuf,PG_DIAG_SEVERITY_NONLOCALIZED);
33253323
err_sendstring(&msgbuf,sev);
33263324

3327-
/* unpack MAKE_SQLSTATE code */
3328-
ssval=edata->sqlerrcode;
3329-
for (i=0;i<5;i++)
3330-
{
3331-
tbuf[i]=PGUNSIXBIT(ssval);
3332-
ssval >>=6;
3333-
}
3334-
tbuf[i]='\0';
3335-
33363325
pq_sendbyte(&msgbuf,PG_DIAG_SQLSTATE);
3337-
err_sendstring(&msgbuf,tbuf);
3326+
err_sendstring(&msgbuf,unpack_sql_state(edata->sqlerrcode));
33383327

33393328
/* M field is required per protocol, so always send something */
33403329
pq_sendbyte(&msgbuf,PG_DIAG_MESSAGE_PRIMARY);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp