Re: dealing with extension dependencies that aren't quite 'e'

From: Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
Subject: Re: dealing with extension dependencies that aren't quite 'e'
Date: 2016-03-25 17:57:20
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

At 2016-03-24 22:48:51 +0530, ams(at)2ndQuadrant(dot)com wrote:
> > I think I would like to see code implement both alternatives to see
> > which one is least ugly. Maybe a third idea will manifest itself
> > upon seeing those.
> Here's the first one. ExecAlterObjectDependsStmt() looks like this:

Here's the second one, which is only slightly different from the first.
ExecAlterObjectDependsStmt() now looks like this:

+ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt)
+ ObjectAddress address;
+ ObjectAddress extAddr;
+ Relation rel = NULL;
+ address = get_object_address_rv(stmt->objectType, stmt->relation, stmt->objname,
+ stmt->objargs, &rel, AccessExclusiveLock, false);
+ if (rel)
+ heap_close(rel, NoLock);
+ extAddr = get_object_address(OBJECT_EXTENSION, stmt->extname, NULL,
+ &rel, AccessExclusiveLock, false);
+ recordDependencyOn(&address, &extAddr, DEPENDENCY_AUTO_EXTENSION);
+ return address;

And the new get_object_address_rv() looks like this:

+get_object_address_rv(ObjectType objtype, RangeVar *rel, List *objname,
+ List *objargs, Relation *relp, LOCKMODE lockmode,
+ bool missing_ok)
+ if (rel)
+ {
+ objname = lcons(makeString(rel->relname), objname);
+ if (rel->schemaname)
+ objname = lcons(makeString(rel->schemaname), objname);
+ if (rel->catalogname)
+ objname = lcons(makeString(rel->catalogname), objname);
+ }
+ return get_object_address(objtype, objname, objargs,
+ relp, lockmode, missing_ok);

Complete patch attached for reference, as before. (I know I haven't
documented the function. I will go through the code to see if there are
any other potential callers, but I wanted to share what I had already.)

-- Abhijit

Attachment Content-Type Size
extdepend-wip-20160325.diff text/x-diff 15.0 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Vladimir Borodin 2016-03-25 18:09:13 Re: Improving replay of XLOG_BTREE_VACUUM records
Previous Message Dmitry Dolgov 2016-03-25 17:47:48 Re: [PATH] Jsonb, insert a new value into an array at arbitrary position