Thread: pgsql: Fix CreatePolicy, pg_dump -v; psql and doc updates

pgsql: Fix CreatePolicy, pg_dump -v; psql and doc updates

From
Stephen Frost
Date:
Fix CreatePolicy, pg_dump -v; psql and doc updates

Peter G pointed out that valgrind was, rightfully, complaining about
CreatePolicy() ending up copying beyond the end of the parsed policy
name.  Name is a fixed-size type and we need to use namein (through
DirectFunctionCall1()) to flush out the entire array before we pass
it down to heap_form_tuple.

Michael Paquier pointed out that pg_dump --verbose was missing a
newline and Fabrízio de Royes Mello further pointed out that the
schema was also missing from the messages, so fix those also.

Also, based on an off-list comment from Kevin, rework the psql \d
output to facilitate copy/pasting into a new CREATE or ALTER POLICY
command.

Lastly, improve the pg_policies view and update the documentation for
it, along with a few other minor doc corrections based on an off-list
discussion with Adam Brightwell.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/78d72563ef141ddc507ddd5ae77db613a309041a

Modified Files
--------------
doc/src/sgml/catalogs.sgml           |   91 +++++++++++++++++++++++++++++++++-
src/backend/catalog/system_views.sql |   10 ++--
src/backend/commands/policy.c        |    2 +-
src/bin/pg_dump/pg_dump.c            |    6 ++-
src/bin/psql/describe.c              |   28 ++++++-----
src/test/regress/expected/rules.out  |   12 ++---
6 files changed, 122 insertions(+), 27 deletions(-)


Re: pgsql: Fix CreatePolicy, pg_dump -v; psql and doc updates

From
Tom Lane
Date:
Stephen Frost <sfrost@snowman.net> writes:
> Fix CreatePolicy, pg_dump -v; psql and doc updates

Just as a note, this should've included a catversion bump.  The rule of
thumb is that if you need to do an initdb (not just a recompile) to get
the regression tests to pass, there should be a catversion bump.  And
that applies here, because the old system_views definition won't match
rules.out.

It's not important enough to go back and change catversion.h now, but
please keep it in mind for the future.  One of the main values of
catversion is to prevent developers from wasting time chasing regression
test failures that are just code-vs-data-skew issues.

            regards, tom lane


Re: pgsql: Fix CreatePolicy, pg_dump -v; psql and doc updates

From
Peter Geoghegan
Date:
On Fri, Oct 3, 2014 at 3:06 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> It's not important enough to go back and change catversion.h now, but
> please keep it in mind for the future.  One of the main values of
> catversion is to prevent developers from wasting time chasing regression
> test failures that are just code-vs-data-skew issues.

It would be nice to institutionalize the idea of "private OIDs", too,
each represented by constants like PG_PRIVATE_OID_ONE (it would
probably go up to TEN, or thereabouts). Fixing duplicates when
rebasing a patch is something that we could thereby avoid - It would
become the responsibility of the committer to adjust the OIDs to
conventional "public OIDs" before pushing to the master branch, just
like it is currently left to the commiter to bump catversion. That
work could even be scripted, I think.

I like picking pg_proc OIDs that are at the beginning of some unused
range, and so do other people, so this happens more often than you
might think.
--
Peter Geoghegan


Re: pgsql: Fix CreatePolicy, pg_dump -v; psql and doc updates

From
Stephen Frost
Date:
Tom,

On Friday, October 3, 2014, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Just as a note, this should've included a catversion bump.  The rule of
thumb is that if you need to do an initdb (not just a recompile) to get
the regression tests to pass, there should be a catversion bump.  And
that applies here, because the old system_views definition won't match
rules.out.

Argh, my apologies- I knew that it would need one, just plain forgot. 

Sorry and thanks for making a note of it for anyone else who saw issues because of it. 

Stephen