icu_ext.c
/*
 * Compare two strings with the collation of the function,
 * which must be an ICU collation.
 * Return the result as a signed integer, similarly to strcoll().
 */
Compare two strings with the collation of the function,
which must be an ICU collation.
Return the result as a signed integer, similarly to strcoll().
Compare two strings with the collation of the function which must be an ICU collation . Return the result as a signed integer similarly to strcoll () .
Datum
icu_compare(PG_FUNCTION_ARGS)
{
	text *txt1 = PG_GETARG_TEXT_PP(0);
	text *txt2 = PG_GETARG_TEXT_PP(1);	
	UCollator *collator = ucollator_from_coll_id(PG_GET_COLLATION());
	UCollationResult result;
	result = our_strcoll(txt1, txt2, collator);
	PG_RETURN_INT32(result == UCOL_EQUAL ? 0 :
					(result == UCOL_GREATER ? 1 : -1));
}
Datum icu_compare ( PG_FUNCTION_ARGS ) { text * txt1 = PG_GETARG_TEXT_PP ( 0 ) ; text * txt2 = PG_GETARG_TEXT_PP ( 1 ) ; UCollator * collator = ucollator_from_coll_id ( PG_GET_COLLATION ( ) ) ; UCollationResult result ; result = our_strcoll ( txt1 , txt2 , collator ) ; PG_RETURN_INT32 ( result == UCOL_EQUAL ? 0 : ( result == UCOL_GREATER ? 1 : -1 ) ) ; }
Compare two strings with the collation of the function,
 which must be an ICU collation.
Compare two strings with the collation of the function which must be an ICU collation .