]> granicus.if.org Git - postgresql/commitdiff
Fix psql \d output of policies.
authorJoe Conway <mail@joeconway.com>
Mon, 3 Aug 2015 16:07:47 +0000 (09:07 -0700)
committerJoe Conway <mail@joeconway.com>
Mon, 3 Aug 2015 16:07:47 +0000 (09:07 -0700)
psql neglected to wrap parenthesis around USING and WITH CHECK
expressions -- fixed. Back-patched to 9.5 where RLS policies were
introduced.

src/bin/psql/describe.c

index f63c7e90d3c0a512305e84dc6ffa0906e6096284..898f8b39cdcbe9b03725b5c7a352cf9410e3fab8 100644 (file)
@@ -2083,11 +2083,11 @@ describeOneTableDetails(const char *schemaname,
                                }
 
                                if (!PQgetisnull(result, i, 2))
-                                       appendPQExpBuffer(&buf, "\n      USING %s",
+                                       appendPQExpBuffer(&buf, "\n      USING (%s)",
                                                                          PQgetvalue(result, i, 2));
 
                                if (!PQgetisnull(result, i, 3))
-                                       appendPQExpBuffer(&buf, "\n      WITH CHECK %s",
+                                       appendPQExpBuffer(&buf, "\n      WITH CHECK (%s)",
                                                                          PQgetvalue(result, i, 3));
 
                                printTableAddFooter(&cont, buf.data);