diff --git a/Docs/manual.texi b/Docs/manual.texi index e4e96cb364b..a9f72cc95cc 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -35217,6 +35217,9 @@ In other words, you can't access the values of the old row from a @code{REPLACE} statement. In some old MySQL versions it appeared that you could do this, but that was a bug that has been corrected. +To be able to use @code{REPLACE} you must have @code{INSERT} and +@code{DELETE} privileges for the table. + When you use a @code{REPLACE} command, @code{mysql_affected_rows()} will return 2 if the new row replaced an old row. This is because one row was inserted and then the duplicate was deleted. @@ -50237,6 +50240,8 @@ each individual 4.0.x release. @item Give error if one has more than 2 ^ 32 rows in a MyISAM MERGE file and one has not compiled MySQL with @code{-DBIG_TABLES}. +@item +Don't require @code{UPDATE} privilege when using @code{REPLACE}. @end itemize @node News-4.0.4, News-4.0.3, News-4.0.5, News-4.0.x diff --git a/configure.in b/configure.in index 8c3f06445c2..af865f21d6e 100644 --- a/configure.in +++ b/configure.in @@ -481,7 +481,7 @@ AC_ARG_WITH(other-libc, # we need special flags, but we will have to add those later STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv" STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS" - OTHER_LIBC_LIB="-L$other_libc_lib" + OTHER_LIBC_LIB="-static -L$other_libc_lib" static_nss=1 else # this is a dirty hack. We if we detect static nss glibc in the special @@ -2241,10 +2241,7 @@ then AC_DEFINE(THREAD_SAFE_CLIENT) fi -if test "$static_nss" = "1" -then - CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS" -fi +CLIENT_LIBS="$CLIENT_LIBS $STATIC_NSS_FLAGS" AC_SUBST(CLIENT_LIBS) AC_SUBST(sql_client_dirs) @@ -2391,11 +2388,8 @@ fi # I know to add the static NSS magic if we have static NSS libraries with # glibc - Sasha -if test "$static_nss" = "1" -then - LDFLAGS="$LDFLAGS -static $OTHER_LIBC_LIB" - LIBS="$LIBS $STATIC_NSS_FLAGS" -fi +LDFLAGS="$LDFLAGS $OTHER_LIBC_LIB" +LIBS="$LIBS $STATIC_NSS_FLAGS" AC_SUBST(sql_server_dirs) AC_SUBST(thread_dirs) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9e834e3cab9..d6e40889eed 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1878,10 +1878,10 @@ mysql_execute_command(void) lex->lock_option); break; case SQLCOM_REPLACE: - if (check_access(thd,INSERT_ACL | UPDATE_ACL | DELETE_ACL, + if (check_access(thd,INSERT_ACL | DELETE_ACL, tables->db,&tables->grant.privilege)) goto error; /* purecov: inspected */ - if (grant_option && check_grant(thd,INSERT_ACL | UPDATE_ACL | DELETE_ACL, + if (grant_option && check_grant(thd,INSERT_ACL | DELETE_ACL, tables)) goto error; @@ -1899,7 +1899,7 @@ mysql_execute_command(void) */ { ulong privilege= (lex->sql_command == SQLCOM_INSERT_SELECT ? - INSERT_ACL : INSERT_ACL | UPDATE_ACL | DELETE_ACL); + INSERT_ACL : INSERT_ACL | DELETE_ACL); TABLE_LIST *save_next=tables->next; tables->next=0; if (check_access(thd, privilege,