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

Commit21a7fa8

Browse files
committed
It is not fixed and I doubt that it is working fine in current CVS. The
bugfix is in the attached patch. Please apply it. Thanks. Output must be:test=# SELECT to_char(485, 'RN'); to_char----------------- CDLXXXV(1 row)test=# SELECT to_char(485, 'FMRN'); to_char--------- CDLXXXV(1 row)test=# SELECT to_char(1000, 'RN'); to_char----------------- M(1 row)test=# SELECT to_char(7.2, '"Welcome to"9.9 "release! :-)"'); to_char----------------------------- Welcome to 7.2 release! :-)(1 row)Karel Zak
1 parent33a82e7 commit21a7fa8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.39 2001/09/06 03:22:42 momjian Exp $
4+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.40 2001/09/12 04:01:57 momjian Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
@@ -45,8 +45,9 @@
4545
*Karel Zak
4646
*
4747
* TODO
48-
*- check last used entry in the cache_search
49-
*- better number building (formatting)
48+
*- better number building (formatting) / parsing, now it isn't
49+
* ideal code
50+
*- use Assert()
5051
*- add support for abstime
5152
*- add support for roman number to standard number conversion
5253
*- add support for number spelling
@@ -3824,6 +3825,10 @@ NUM_numpart_to_char(NUMProc *Np, int id)
38243825
++Np->num_curr;
38253826
}
38263827

3828+
/*
3829+
* Note: 'plen' is used in FROM_CHAR conversion and it's length of
3830+
* input (inout). In TO_CHAR conversion it's space before first number.
3831+
*/
38273832
staticchar*
38283833
NUM_processor(FormatNode*node,NUMDesc*Num,char*inout,char*number,
38293834
intplen,intsign,inttype)
@@ -4117,17 +4122,17 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
41174122
Np->inout_p+=strlen(Np->inout_p)-1;
41184123
}
41194124
else
4120-
Np->inout_p+=snprintf(Np->inout_p,plen- (Np->inout_p-Np->inout),"%15s",Np->number_p)-1;
4125+
Np->inout_p+=sprintf(Np->inout_p,"%15s",Np->number_p)-1;
41214126
break;
4122-
4127+
41234128
caseNUM_rn:
41244129
if (IS_FILLMODE(Np->Num))
41254130
{
41264131
strcpy(Np->inout_p,str_tolower(Np->number_p));
41274132
Np->inout_p+=strlen(Np->inout_p)-1;
41284133
}
41294134
else
4130-
Np->inout_p+=snprintf(Np->inout_p,plen- (Np->inout_p-Np->inout),"%15s",str_tolower(Np->number_p))-1;
4135+
Np->inout_p+=sprintf(Np->inout_p,"%15s",str_tolower(Np->number_p))-1;
41314136
break;
41324137

41334138
caseNUM_th:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp