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

Commit132d090

Browse files
author
Neil Conway
committed
Minor correction for previous SQLSTATE patch: I changed dsqrt() to emit the
right error code previously, and this patch applies an analogous changeto numeric_sqrt().
1 parentf16874c commit132d090

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/backend/utils/adt/numeric.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 1998-2003, PostgreSQL Global Development Group
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.75 2004/05/16 23:18:55 neilc Exp $
17+
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.76 2004/05/19 04:32:26 neilc Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -4210,9 +4210,13 @@ sqrt_var(NumericVar *arg, NumericVar *result, int rscale)
42104210
return;
42114211
}
42124212

4213+
/*
4214+
* SQL2003 defines sqrt() in terms of power, so we need to emit
4215+
* the right SQLSTATE error code if the operand is negative.
4216+
*/
42134217
if (stat<0)
42144218
ereport(ERROR,
4215-
(errcode(ERRCODE_FLOATING_POINT_EXCEPTION),
4219+
(errcode(ERRCODE_INVALID_ARGUMENT_FOR_POWER_FUNCTION),
42164220
errmsg("cannot take square root of a negative number")));
42174221

42184222
init_var(&tmp_arg);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp