agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: amit <amitlangote09@gmail.com>
Subject: [PATCH 2/7] Add a IGNORE dependency type.
Date: Fri, 13 May 2016 12:10:10 +0900
This new type of dependency is mainly to be used internally as a signal
that no dependency should be created between the objects in question.
Use this, for example, when there is a possibility that redundant self-
dependencies could be created in certain situations - imagine creation
of dependencies for objects referenced in expressions in the partition
key of a table; it is inevitable that vars of the table in question
would be encountered which must be ignored.
---
src/backend/catalog/dependency.c | 2 ++
src/backend/catalog/pg_depend.c | 3 +++
src/include/catalog/dependency.h | 8 +++++++-
3 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index 04d7840..607274d 100644
--- a/src/backend/catalog/dependency.c
+++ b/src/backend/catalog/dependency.c
@@ -717,6 +717,7 @@ findDependentObjects(const ObjectAddress *object,
getObjectDescription(object));
break;
default:
+ Assert(foundDep->deptype != DEPENDENCY_IGNORE);
elog(ERROR, "unrecognized dependency type '%c' for %s",
foundDep->deptype, getObjectDescription(object));
break;
@@ -813,6 +814,7 @@ findDependentObjects(const ObjectAddress *object,
subflags = 0; /* keep compiler quiet */
break;
default:
+ Assert(foundDep->deptype != DEPENDENCY_IGNORE);
elog(ERROR, "unrecognized dependency type '%c' for %s",
foundDep->deptype, getObjectDescription(object));
subflags = 0; /* keep compiler quiet */
diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c
index 7a0713e..6e71b44 100644
--- a/src/backend/catalog/pg_depend.c
+++ b/src/backend/catalog/pg_depend.c
@@ -65,6 +65,9 @@ recordMultipleDependencies(const ObjectAddress *depender,
bool nulls[Natts_pg_depend];
Datum values[Natts_pg_depend];
+ if (behavior == DEPENDENCY_IGNORE)
+ return; /* nothing to do */
+
if (nreferenced <= 0)
return; /* nothing to do */
diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h
index 09b36c5..d44edc6 100644
--- a/src/include/catalog/dependency.h
+++ b/src/include/catalog/dependency.h
@@ -67,6 +67,11 @@
* created only during initdb. The fields for the dependent object
* contain zeroes.
*
+ * DEPENDENCY_IGNORE ('g'): like DEPENDENCY_PIN, there is no dependent
+ * object; this type of entry is a signal that no dependency should be
+ * created between the objects in question. However, unlike pin,
+ * dependencies, these never make it to pg_depend.
+ *
* Other dependency flavors may be needed in future.
*/
@@ -77,7 +82,8 @@ typedef enum DependencyType
DEPENDENCY_INTERNAL = 'i',
DEPENDENCY_EXTENSION = 'e',
DEPENDENCY_AUTO_EXTENSION = 'x',
- DEPENDENCY_PIN = 'p'
+ DEPENDENCY_PIN = 'p',
+ DEPENDENCY_IGNORE = 'g'
} DependencyType;
/*
--
1.7.1
--------------050808050504080802030900
Content-Type: text/x-diff;
name="0003-Infrastructure-for-creation-of-partitioned-tables-v5.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0003-Infrastructure-for-creation-of-partitioned-tables-v5.pa";
filename*1="tch"
view thread (4+ messages) latest in thread
Message-ID: <no-message-id-818902@localhost>
Permalink: ../../no-message-id-818902@localhost/
Also on: postgresql.org/message-id/no-message-id-818902@localhost
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: pgsql-hackers@postgresql.org
Cc: amitlangote09@gmail.com
Subject: Re: [PATCH 2/7] Add a IGNORE dependency type.
In-Reply-To: <no-message-id-818902@localhost>
* 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