@@ -56,7 +56,7 @@ int rowid_seq_cache = 20;
5656
5757#ifdef IVY_GUC_VAR_STRUCT
5858
59- /* The comments shown as blow define the
59+ /* The comments shown as below define the
6060 * value range of guc parameters "database_mode"
6161 * and "compatible_db".
6262 */
@@ -184,15 +184,15 @@ static struct config_bool Ivy_ConfigureNamesBool[] =
184184 },
185185
186186 /*
187- * ivorysql.default_with_rowids
187+ * ivorysql.default_with_rowids
188188 *
189189 * When enabled, all newly created tables will automatically include
190190 * an Oracle-compatible ROWID pseudo-column. This provides compatibility
191191 * with Oracle applications that rely on ROWID for row identification.
192192 *
193193 * Default: off
194194 * Context: USERSET (can be changed by any user)
195- */
195+ */
196196 {
197197 {"ivorysql.default_with_rowids" , PGC_USERSET , DEVELOPER_OPTIONS ,
198198 gettext_noop ("Automatically add rowid column when creating new tables." ),
@@ -420,7 +420,7 @@ static struct config_enum Ivy_ConfigureNamesEnum[] =
420420
421421 {
422422 {"nls_length_semantics" , PGC_USERSET , COMPAT_ORACLE_OPTIONS ,
423- gettext_noop ("Compatible Oracle NLS parameter for charater data type." ),
423+ gettext_noop ("Compatible Oracle NLS parameter for character data type." ),
424424 gettext_noop ("Valid values are CHAR, BYTE." ),
425425 GUC_IS_NAME | GUC_NOT_IN_SAMPLE
426426 },
@@ -477,7 +477,7 @@ check_compatible_mode(int *newval, void **extra, GucSource source)
477477 ereport (ERROR ,
478478 (errcode (ERRCODE_SYSTEM_ERROR ),
479479 errmsg ("IVORYSQL_ORA library not found!" ),
480- errhint ("You must load IVORYSQL_ORA to use oracle parser.. " )));
480+ errhint ("You must load IVORYSQL_ORA to use oracle parser." )));
481481 }
482482 }
483483 return true;
@@ -529,19 +529,21 @@ static void
529529nls_case_conversion (char * * param , char type )
530530{
531531 char * p ;
532+ size_t len ;
532533
533534CASE_CONVERSION :
535+ len = strlen (* param );
534536 if (type == 'u' )
535537 {
536- for (p = * param ; p < * param + strlen ( * param ) ; ++ p )
537- if (97 <= * p && * p <= 122 )
538+ for (p = * param ; p < * param + len ; ++ p )
539+ if ('a' <= * p && * p <= 'z' )
538540 * p -= 32 ;
539541 * p = '\0' ;
540542 }
541543 else if (type == 'l' )
542544 {
543- for (p = * param ; p < * param + strlen ( * param ) ; ++ p )
544- if (65 <= * p && * p <= 90 )
545+ for (p = * param ; p < * param + len ; ++ p )
546+ if ('A' <= * p && * p <= 'Z' )
545547 * p += 32 ;
546548 * p = '\0' ;
547549 }
@@ -550,11 +552,11 @@ nls_case_conversion(char **param, char type)
550552 bool has_upper = false,
551553 has_lower = false;
552554
553- for (p = * param ; p < * param + strlen ( * param ) ; ++ p )
555+ for (p = * param ; p < * param + len ; ++ p )
554556 {
555- if (65 <= * p && * p <= 90 )
557+ if ('A' <= * p && * p <= 'Z' )
556558 has_upper = true;
557- else if (97 <= * p && * p <= 122 )
559+ else if ('a' <= * p && * p <= 'z' )
558560 has_lower = true;
559561 if (has_upper && has_lower )
560562 return ;
@@ -579,10 +581,14 @@ nls_length_check(char **newval, void **extra, GucSource source)
579581 && (IsNormalProcessingMode () || (IsUnderPostmaster && MyProcPort )))
580582 {
581583 if (strlen (* newval ) > 255 )
582- ereport (ERROR , (errmsg ("parameter value longer than 255 characters" )));
584+ ereport (ERROR ,
585+ (errcode (ERRCODE_STRING_DATA_RIGHT_TRUNCATION ),
586+ errmsg ("parameter value longer than 255 characters" )));
583587 else if (isdigit (* * newval ))
584- ereport (ERROR , (errmsg ("Cannot access NLS data files "
585- "or invalid environment specified" )));
588+ ereport (ERROR ,
589+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
590+ errmsg ("Cannot access NLS data files "
591+ "or invalid environment specified" )));
586592 else if (identifier_case_switch == INTERCHANGE )
587593 nls_case_conversion (newval , 'b' );
588594 }
@@ -601,8 +607,10 @@ nls_territory_check(char **newval, void **extra, GucSource source)
601607 else if (pg_strcasecmp (* newval , "AMERICA" ) == 0 )
602608 memcpy (* newval , "AMERICA" , 7 );
603609 else
604- ereport (ERROR , (errmsg ("Cannot access NLS data files "
605- "or invalid environment specified" )));
610+ ereport (ERROR ,
611+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
612+ errmsg ("Cannot access NLS data files "
613+ "or invalid environment specified" )));
606614 }
607615
608616 return true;
0 commit comments