Sort out table_open vs. relation_open in rewriter

table_open() is a wrapper around relation_open() that checks that the
relkind is table-like and gives a user-facing error message if not.
It is best used in directly user-facing areas to check that the user
used the right kind of command for the relkind.  In internal uses
where the relkind was previously checked from the user's perspective,
table_open() is not necessary and might even be confusing if it were
to give out-of-context error messages.

In rewriteHandler.c, there were several such table_open() calls, which
this changes to relation_open().  This currently doesn't make a
difference, but there are plans to have other relkinds that could
appear in the rewriter but that shouldn't be accessible via
table-specific commands, and this clears the way for that.

Reviewed-by: Ashutosh Bapat <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/6d3fef19-a420-4e11-8235-8ea534bf2080%40eisentraut.org
Discussion: 
https://www.postgresql.org/message-id/flat/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d537f59fbbfcd3b50a7208b1320a0fa73ca589f5

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

Reply via email to