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

Commit283939a

Browse files
committed
varstr_cmp and any comparison function that piggybacks on it can return
any negative or positive number, not just -1 or 1. Fix comment onvarstr_cmp and citext test case accordingly.As pointed out by Zdenek Kotala, and buildfarm member gothic moth.
1 parent8d4f2ec commit283939a

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

‎contrib/citext/expected/citext.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ SELECT citext_cmp('AARDVARK'::citext, 'AARDVARK'::citext) AS zero;
213213
0
214214
(1 row)
215215

216-
SELECT citext_cmp('B'::citext, 'a'::citext) ASone;
217-
one
218-
-----
219-
1
216+
SELECT citext_cmp('B'::citext, 'a'::citext)> 0AStrue;
217+
true
218+
------
219+
t
220220
(1 row)
221221

222222
-- Do some tests using a table and index.

‎contrib/citext/expected/citext_1.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ SELECT citext_cmp('AARDVARK'::citext, 'AARDVARK'::citext) AS zero;
213213
0
214214
(1 row)
215215

216-
SELECT citext_cmp('B'::citext, 'a'::citext) ASone;
217-
one
218-
-----
219-
1
216+
SELECT citext_cmp('B'::citext, 'a'::citext)> 0AStrue;
217+
true
218+
------
219+
t
220220
(1 row)
221221

222222
-- Do some tests using a table and index.

‎contrib/citext/sql/citext.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ SELECT 'aardvark'::citext = 'aardVark'::citext AS t;
9090
SELECT citext_cmp('aardvark'::citext,'aardvark'::citext)AS zero;
9191
SELECT citext_cmp('aardvark'::citext,'aardVark'::citext)AS zero;
9292
SELECT citext_cmp('AARDVARK'::citext,'AARDVARK'::citext)AS zero;
93-
SELECT citext_cmp('B'::citext,'a'::citext)ASone;
93+
SELECT citext_cmp('B'::citext,'a'::citext)>0AStrue;
9494

9595
-- Do some tests using a table and index.
9696

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.169 2009/01/01 17:23:50 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.170 2009/04/23 07:19:09 heikki Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1138,7 +1138,8 @@ text_position_cleanup(TextPositionState *state)
11381138
* Comparison function for text strings with given lengths.
11391139
* Includes locale support, but must copy strings to temporary memory
11401140
*to allow null-termination for inputs to strcoll().
1141-
* Returns -1, 0 or 1
1141+
* Returns an integer less than, equal to, or greater than zero, indicating
1142+
* whether arg1 is less than, equal to, or greater than arg2.
11421143
*/
11431144
int
11441145
varstr_cmp(char*arg1,intlen1,char*arg2,intlen2)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp