Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 96 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ BISON
MKDIR_P
LN_S
TAR
USE_MDBLOCALES
install_bin
INSTALL_DATA
INSTALL_SCRIPT
Expand Down Expand Up @@ -945,6 +946,7 @@ with_rt
with_libcurl
with_apr_config
with_gnu_ld
with_mdblocales
with_ssl
with_openssl
enable_openssl_redirect
Expand Down Expand Up @@ -1693,6 +1695,7 @@ Optional Packages:
--without-libcurl do not use libcurl
--with-apr-config=PATH path to apr-1-config utility
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--without-mdblocales build without MDB locales
--with-ssl=LIB use LIB for SSL/TLS support (openssl)
--with-openssl obsolete spelling of --with-ssl=openssl

Expand Down Expand Up @@ -2909,7 +2912,6 @@ PG_PACKAGE_VERSION=14.4




ac_aux_dir=
for ac_dir in config "$srcdir"/config; do
if test -f "$ac_dir/install-sh"; then
Expand Down Expand Up @@ -12208,6 +12210,38 @@ case $INSTALL in
esac


#
# MDB locales
#




# Check whether --with-mdblocales was given.
if test "${with_mdblocales+set}" = set; then :
withval=$with_mdblocales;
case $withval in
yes)

$as_echo "#define USE_MDBLOCALES 1" >>confdefs.h

;;
no)
:
;;
*)
as_fn_error $? "no argument expected for --with-mdblocales option" "$LINENO" 5
;;
esac

else
with_mdblocales=no

fi




if test -z "$TAR"; then
for ac_prog in tar
do
Expand Down Expand Up @@ -12844,6 +12878,56 @@ $as_echo "${python_libspec} ${python_additional_libs}" >&6; }



fi

if test "$with_mdblocales" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mdb_setlocale in -lmdblocales" >&5
$as_echo_n "checking for mdb_setlocale in -lmdblocales... " >&6; }
if ${ac_cv_lib_mdblocales_mdb_setlocale+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lmdblocales $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char mdb_setlocale ();
int
main ()
{
return mdb_setlocale ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_mdblocales_mdb_setlocale=yes
else
ac_cv_lib_mdblocales_mdb_setlocale=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mdblocales_mdb_setlocale" >&5
$as_echo "$ac_cv_lib_mdblocales_mdb_setlocale" >&6; }
if test "x$ac_cv_lib_mdblocales_mdb_setlocale" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBMDBLOCALES 1
_ACEOF

LIBS="-lmdblocales $LIBS"

else
as_fn_error $? "mdblocales library not found" "$LINENO" 5
fi

fi

if test x"$cross_compiling" = x"yes" && test -z "$with_system_tzdata"; then
Expand Down Expand Up @@ -17065,6 +17149,17 @@ fi

done

fi

if test "$with_mdblocales" = yes; then
ac_fn_c_check_header_mongrel "$LINENO" "mdblocales.h" "ac_cv_header_mdblocales_h" "$ac_includes_default"
if test "x$ac_cv_header_mdblocales_h" = xyes; then :

else
as_fn_error $? "mdblocales header not found." "$LINENO" 5
fi


fi

if test "$with_gssapi" = yes ; then
Expand Down
17 changes: 17 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,14 @@ case $INSTALL in
esac
AC_SUBST(install_bin)

#
# MDB locales
#

PGAC_ARG_BOOL(with, mdblocales, yes, [build without MDB locales],
[AC_DEFINE([USE_MDBLOCALES], 1, [Define to 1 to build with MDB locales. (--with-mdblocales)])])
AC_SUBST(USE_MDBLOCALES)

PGAC_PATH_PROGS(TAR, tar)
AC_PROG_LN_S
AC_PROG_MKDIR_P
Expand Down Expand Up @@ -1620,6 +1628,11 @@ failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support.])])
fi

if test "$with_mdblocales" = yes; then
AC_CHECK_LIB(mdblocales, mdb_setlocale, [],
[AC_MSG_ERROR([mdblocales library not found])])
fi

if test "$enable_external_fts" = yes; then
AC_CHECK_LIB(jansson, jansson_version_str, [],
[AC_MSG_ERROR([jansson library not found or version is too old, version must >= 2.13])])
Expand Down Expand Up @@ -1999,6 +2012,10 @@ if test "$with_lz4" = yes; then
AC_CHECK_HEADERS(lz4.h, [], [AC_MSG_ERROR([lz4.h header file is required for LZ4])])
fi

if test "$with_mdblocales" = yes; then
AC_CHECK_HEADER(mdblocales.h, [], [AC_MSG_ERROR([mdblocales header not found.])])
fi

if test "$with_gssapi" = yes ; then
AC_CHECK_HEADERS(gssapi/gssapi.h, [],
[AC_CHECK_HEADERS(gssapi.h, [], [AC_MSG_ERROR([gssapi.h header file is required for GSSAPI])])])
Expand Down
5 changes: 3 additions & 2 deletions contrib/pax_storage/src/cpp/storage/oper/pax_oper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*-------------------------------------------------------------------------
*/

#include "common/mdb_locale.h"
#include "storage/oper/pax_oper.h"

#include "comm/cbdb_wrappers.h"
Expand Down Expand Up @@ -588,9 +589,9 @@ static inline bool LocaleIsC(Oid collation) {
return (bool)result;
}

localeptr = setlocale(LC_COLLATE, NULL);
localeptr = SETLOCALE(LC_COLLATE, NULL);
CBDB_CHECK(localeptr, cbdb::CException::ExType::kExTypeCError,
fmt("Invalid locale, fail to `setlocale`, errno: %d", errno));
fmt("Invalid locale, fail to `SETLOCALE`, errno: %d", errno));

if (strcmp(localeptr, "C") == 0 || // cut line
strcmp(localeptr, "POSIX") == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ SET SESSION AUTHORIZATION regress_unpriv_user;
SET search_path TO temp_func_test, public;
ALTER FUNCTION functest_E_1(int) NOT LEAKPROOF;
ALTER FUNCTION functest_E_2(int) LEAKPROOF;
ERROR: only superuser can define a leakproof function
ERROR: only superuser or mdb_admin can define a leakproof function
CREATE FUNCTION functest_E_3(int) RETURNS bool LANGUAGE 'sql'
LEAKPROOF AS 'SELECT $1 < 200'; -- fail
ERROR: only superuser can define a leakproof function
ERROR: only superuser or mdb_admin can define a leakproof function
RESET SESSION AUTHORIZATION;
--
-- CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ SET SESSION AUTHORIZATION regress_unpriv_user;
SET search_path TO temp_func_test, public;
ALTER FUNCTION functest_E_1(int) NOT LEAKPROOF;
ALTER FUNCTION functest_E_2(int) LEAKPROOF;
ERROR: only superuser can define a leakproof function
ERROR: only superuser or mdb_admin can define a leakproof function
CREATE FUNCTION functest_E_3(int) RETURNS bool LANGUAGE 'sql'
LEAKPROOF AS 'SELECT $1 < 200'; -- fail
ERROR: only superuser can define a leakproof function
ERROR: only superuser or mdb_admin can define a leakproof function
RESET SESSION AUTHORIZATION;
--
-- CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
Expand Down
9 changes: 5 additions & 4 deletions gpcontrib/orafce/others.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "utils/uuid.h"
#include "orafce.h"
#include "builtins.h"
#include "common/mdb_locale.h"

/*
* Source code for nlssort is taken from postgresql-nls-string
Expand Down Expand Up @@ -322,7 +323,7 @@ _nls_run_strxfrm(text *string, text *locale)
*/
if (!lc_collate_cache)
{
if ((lc_collate_cache = setlocale(LC_COLLATE, NULL)))
if ((lc_collate_cache = SETLOCALE(LC_COLLATE, NULL)))
/* Make a copy of the locale name string. */
#ifdef _MSC_VER
lc_collate_cache = _strdup(lc_collate_cache);
Expand Down Expand Up @@ -364,7 +365,7 @@ _nls_run_strxfrm(text *string, text *locale)
* If setlocale failed, we know the default stayed the same,
* co we can safely elog.
*/
if (!setlocale(LC_COLLATE, locale_str))
if (!SETLOCALE(LC_COLLATE, locale_str))
elog(ERROR, "failed to set the requested LC_COLLATE value [%s]", locale_str);

changed_locale = true;
Expand Down Expand Up @@ -409,7 +410,7 @@ _nls_run_strxfrm(text *string, text *locale)
/*
* Set original locale
*/
if (!setlocale(LC_COLLATE, lc_collate_cache))
if (!SETLOCALE(LC_COLLATE, lc_collate_cache))
elog(FATAL, "failed to set back the default LC_COLLATE value [%s]", lc_collate_cache);
}

Expand All @@ -422,7 +423,7 @@ _nls_run_strxfrm(text *string, text *locale)
/*
* Set original locale
*/
if (!setlocale(LC_COLLATE, lc_collate_cache))
if (!SETLOCALE(LC_COLLATE, lc_collate_cache))
elog(FATAL, "failed to set back the default LC_COLLATE value [%s]", lc_collate_cache);
pfree(locale_str);
}
Expand Down
Loading
Loading