public inbox for [email protected]
help / color / mirror / Atom feedFrom: jian he <[email protected]>
To: PostgreSQL-development <[email protected]>
Subject: remove unnecessary include in src/backend/commands/policy.c
Date: Sun, 14 Sep 2025 14:37:28 +0800
Message-ID: <CACJufxFvcqOd6g6uaQqKuKPRgcEfPwp_tLSaaxDiHFBb2snJDA@mail.gmail.com> (raw)
hi.
in src/backend/commands/policy.c, i found that
#include "access/htup.h"
#include "access/htup_details.h"
#include "catalog/catalog.h"
#include "nodes/pg_list.h"
#include "parser/parse_node.h"
#include "utils/array.h"
is not necessary "include", so I removed it.
we can also remove
#include "access/relation.h"
replace relation_open to table_open, since we already did relkind check in
RangeVarCallbackForPolicy.
Attachments:
[text/x-patch] v1-0001-remove-unnecessary-include-in-policy.c.patch (3.0K, ../CACJufxFvcqOd6g6uaQqKuKPRgcEfPwp_tLSaaxDiHFBb2snJDA@mail.gmail.com/2-v1-0001-remove-unnecessary-include-in-policy.c.patch)
download | inline diff:
From 5ba1586d0844ec40674338ad920b12a61dd646ed Mon Sep 17 00:00:00 2001
From: jian he <[email protected]>
Date: Sun, 14 Sep 2025 14:35:33 +0800
Subject: [PATCH v1 1/1] remove unnecessary include in policy.c
discussion: https://postgr.es/m/
---
src/backend/commands/policy.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/src/backend/commands/policy.c b/src/backend/commands/policy.c
index 83056960fe4..ce3eb10ae86 100644
--- a/src/backend/commands/policy.c
+++ b/src/backend/commands/policy.c
@@ -13,12 +13,8 @@
#include "postgres.h"
#include "access/genam.h"
-#include "access/htup.h"
-#include "access/htup_details.h"
-#include "access/relation.h"
#include "access/table.h"
#include "access/xact.h"
-#include "catalog/catalog.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
@@ -28,15 +24,12 @@
#include "catalog/pg_type.h"
#include "commands/policy.h"
#include "miscadmin.h"
-#include "nodes/pg_list.h"
#include "parser/parse_clause.h"
#include "parser/parse_collate.h"
-#include "parser/parse_node.h"
#include "parser/parse_relation.h"
#include "rewrite/rewriteManip.h"
#include "rewrite/rowsecurity.h"
#include "utils/acl.h"
-#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/inval.h"
@@ -630,7 +623,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
stmt);
/* Open target_table to build quals. No additional lock is necessary. */
- target_table = relation_open(table_id, NoLock);
+ target_table = table_open(table_id, NoLock);
/* Add for the regular security quals */
nsitem = addRangeTableEntryForRelation(qual_pstate, target_table,
@@ -752,7 +745,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
free_parsestate(qual_pstate);
free_parsestate(with_check_pstate);
systable_endscan(sscan);
- relation_close(target_table, NoLock);
+ table_close(target_table, NoLock);
table_close(pg_policy_rel, RowExclusiveLock);
return myself;
@@ -805,7 +798,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
RangeVarCallbackForPolicy,
stmt);
- target_table = relation_open(table_id, NoLock);
+ target_table = table_open(table_id, NoLock);
/* Parse the using policy clause */
if (stmt->qual)
@@ -1082,7 +1075,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
/* Clean up. */
systable_endscan(sscan);
- relation_close(target_table, NoLock);
+ table_close(target_table, NoLock);
table_close(pg_policy_rel, RowExclusiveLock);
return myself;
@@ -1110,7 +1103,7 @@ rename_policy(RenameStmt *stmt)
RangeVarCallbackForPolicy,
stmt);
- target_table = relation_open(table_id, NoLock);
+ target_table = table_open(table_id, NoLock);
pg_policy_rel = table_open(PolicyRelationId, RowExclusiveLock);
@@ -1189,7 +1182,7 @@ rename_policy(RenameStmt *stmt)
/* Clean up. */
systable_endscan(sscan);
table_close(pg_policy_rel, RowExclusiveLock);
- relation_close(target_table, NoLock);
+ table_close(target_table, NoLock);
return address;
}
--
2.34.1
view thread (11+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: remove unnecessary include in src/backend/commands/policy.c
In-Reply-To: <CACJufxFvcqOd6g6uaQqKuKPRgcEfPwp_tLSaaxDiHFBb2snJDA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox