This is an automated email from the ASF dual-hosted git repository.

Smyatkin-Maxim pushed a commit to branch pg-dump-rebase-REL-2
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit fb0fd462c88dbc955a51c9603458690dbd3c35be
Author: Brent Doil <[email protected]>
AuthorDate: Sat Sep 10 11:40:37 2022 -0400

    pg_dump: Omit BYPASSRLS clause for pre GPDB7 server
    
    GPDB5/6 do not support RLS. Without the version gate
    a dump and restore on these server versions will fail.
    
    Authored-by: Brent Doil <[email protected]>
---
 src/bin/pg_dump/pg_dumpall.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index b1ff242a5dd..83473746578 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -1395,10 +1395,13 @@ dumpRoles(PGconn *conn)
                else
                        appendPQExpBufferStr(buf, " NOREPLICATION");
 
-               if (strcmp(PQgetvalue(res, i, i_rolbypassrls), "t") == 0)
-                       appendPQExpBufferStr(buf, " BYPASSRLS");
-               else
-                       appendPQExpBufferStr(buf, " NOBYPASSRLS");
+               if (server_version >= 90600)
+               {
+                       if (strcmp(PQgetvalue(res, i, i_rolbypassrls), "t") == 
0)
+                               appendPQExpBufferStr(buf, " BYPASSRLS");
+                       else
+                               appendPQExpBufferStr(buf, " NOBYPASSRLS");
+               }
 
                if (strcmp(PQgetvalue(res, i, i_rolconnlimit), "-1") != 0)
                        appendPQExpBuffer(buf, " CONNECTION LIMIT %s",


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to