Alternative to SELECT … FOR UPDATE row locking with outer joins

I am trying to achieve some way of FOR UPDATE locking rows returned in a LEFT JOIN. Postgresql does not support combining FOR UPDATE with an other join, since in the case of null rows it has nothing to lock on.

In my current query I had thought it would be enough to just lock on table TableA in a subquery, and left join in table TableB outside of it. The query runs, but it seems that postgresql fetches the rows from the LEFT JOIN regardless of whether the lock on the rows in table TableA could be obtained or not.

My current query looks something like this:

SELECT * FROM (     SELECT j.correlation_id, j.current_state     FROM (         SELECT * FROM "Db"."TableA" WHERE "correlation_id" = @p0 FOR UPDATE     ) AS j     LIMIT 2 ) AS t LEFT JOIN "Db"."TableB" AS j0 ON t.correlation_id = j0.correlation_id ORDER BY t.correlation_id 

So, while Alice is currently running this query and holding the lock in her transaction, Bob tries to execute the same query. The result seems to be that Bob immediately fetches the data specified in the LEFT JOIN, and then waits for the FOR UPDATE lock to release.

Ideally I would want the rows in the JOIN to be locked as well, but at the very least the data from the JOIN should be fetched after the FOR UPDATE lock has been obtained.

Why does my deformed mesh’s outer shape look awkward when none of the inner mesh vertices seem to be moved passed the outer vertices?

I’m trying to deform my mesh but the vertices cause these straight edges to occur where the inner mesh passes the outer mesh and create an awkward shape.

enter image description here

Why does the orange outline of the mesh not match the vertex distribution? The red squares are the outer mesh vertices and the black are the inner vertices and none of the inner vertices seem to pass the outer vertices so why is it creating this shape? What possible approaches are there to fix this?

subquery uses ungrouped column “shops.id” from outer query

I’m making a PSQL query and I’m encountering an error which is:

ERROR:  subquery uses ungrouped column "shops.id" from outer query LINE 8:             WHERE target_id = shops.id AND type = 'started_d... 

My query is :

SELECT  localities.name AS "City",          COUNT(shops) AS "Shops",         CAST(AVG(shops.rating_cache) AS decimal(10, 2)) AS "Rating",         SUM(shops.product_count_cache) AS "Products",         (             SELECT COUNT(*)             FROM customer_events             WHERE target_id = shops.id AND type = 'started_directions'         ) AS "Visites" FROM shops  LEFT JOIN localities ON localities.id = shops.locality_id  WHERE shops.locality_id IN (     SELECT cast(unnest as uuid)      FROM      unnest(string_to_array('9c57227a-8f4e-44e0-a3a8-1439c25bf2e5,8f285bca-baec-442e-8a21-e067b75d8f13', ',')) ) AND shops.onboarding_status = 'ready'  GROUP BY localities.name 

First four selected and calculated columns are working but the 5th which counts the number of customer_events for the current row’s localities.id doesn’t work.

Any idea how to make my column count working ?

Best regards,

EDIT: To clarify one thing, the column target_id is a foreign key to a shop’s id

How do Ethereal objects/creatures work on the Outer planes?

The Ethereal doesn’t border the Outer Planes, and thus spells that allow you to access the Ethereal fail. However some creatures or objects have Ethereal parts to them. What happens to them?

For examples of how this situation can arise:

  • in one adventure set in the Outlands, there is a living trap of scorpions disguised as gold coins. The stingers are described as “Ethereal” even though it takes place on the Outlands. (Or was this detail a mistake?)

  • an Ethereal weapon or creature is forced through a portal

Will the Astral Projection spell end upon entering an Outer Plane?

The astral projection spell states:

If you enter a new plane or return to the plane you were on when casting this spell, your body and possessions are transported along the silver cord, allowing you to re-enter your body as you enter the new plane. Your astral form is a separate incarnation. Any damage or other effects that apply to it have no effect on your physical body, nor do they persist when you return to it.

The highlighted text seems to suggest that, when you enter a new plane via astral projection, your body is transported there as well and you may re-enter your body. This suggests you have lost your astral form and are now physical.

However, DMG 47 implies something different. This section talks about the astral projection spell for the purposes of traveling in the Astral Plane.

Astral Projection

Since the Outer Planes are as much spiritual states of being as they are physical places, this allows a character to manifest in an Outer Plane as if he or she had physically traveled there, but as in a dream.

It further goes on to saying that high level adventurers will often prefer to travel to the Outer Planes via astral projection because dying in this form doesn’t mean “real” death.

So which is the right interpretation? Does astral projection put you back in your real body when entering an Outer Plane, thus ending the spell, or do you remain an astral projection?

Are the Material Planes comprising the various campaign settings surrounded by a shared set of outer planes?

I’m working on an extra-planar supplement for DM’s Guild, and it got me wondering:

Is the 5e cosmological model that the material planes are comprised of all DnD settings, official and otherwise (Forgotten Realms, Eberron, and other published or future campaign worlds), surrounded by the outer planes which are common to all of them?

If this is the case, would that mean that the outer planes are comprised of souls from realms other than the players’ native world? Would a party who ventures there meet souls originally from Eberron, Athas, Greyhawk, etc.?

On the other hand, it’s possible I’m confusing my editions, and in 5e each campaign world has its own greater cosmology. In that case, are the outer planes unique to the Forgotten Realms, and does Eberron, for example, have its own set of outer planes?

Find the key points of the outer layer of n overlapping rectangles – Divide and Conquer

Given a set of $ n$ rectangles depicted as: $ [Li, Ri, Hi]$ whereby the corners of the $ i-th$ rectangle are – $ (Li, 0), (Ri,0), (Li, Hi)$ and $ (Ri, Hi)$ .

The goal is to print all of the key points of the outer layer of the $ n$ overlapping rectangles (given in a list).

Key points $ (Xj, Yj)$ are the points that collectively portray the outer layer of the rectangles – look at the example below:

Given the two blocks [4, 13, 4] and [2, 7, 10] the output should be: [2,0], [2,10], [7,10], [7,4], [13,4] and [13,0] (The points that are marked red).

This should be done in $ O(nlogn)$ time where $ n$ is the number of buildings (rectangles).

enter image description here

I have tried to solve this problem by –

(1) Sorting the blocks by priority: $ Li$ then $ Ri$ then $ Hi$ .

(2) Compare any two blocks: $ [Li, Ri, Hi]$ and $ [Li+1, Ri+1, Hi+1]$ (15 different cases like Li==Li+1 and Hi< Hi+1 and stuff like this).

(3) Remove/add points according to condition (using AVL)

This works in some cases, but in others it fails miserably. I think this can be solved by Convex Hull algorithms, we have only learned the divide and conquer method so far – but I cannot link between this question and this method. I hope you can help me with this one!

Thank you

What signature food or beverage is each outer plane in the Great Wheel Cosmology known for?

Is there a list or reference somewhere showing what meals and / or beverages each outer plane in the Great Wheel Cosmology is best known for?

I am putting together a campaign idea for my PCs, a variant on Smokey and the Bandit. In that movie, there’s a bet that Bandit and Snowman can drive to Texarkana and bring back to Georgia 400 cases of Coors beer within 28 hours.

My idea is that to win a bet the PCs would travel to the four corner Outer planes in the Great Wheel Cosmology, and pick up a signature meal or beverage at each of those four planes, in a time limit, maybe 8 hours. I’m willing to Make Up Stuff, like “Angel Food Cake” from Celestia and “Extremely Hot Salsa made with Peppers from the Abyss”. However, if precedent exists, I’d like to follow it.

If you ask someone on the street which country is better known for Poutine and which for Pasta, chances are they’ll associate Pasta with Italy and Poutine with Canada. That level of association is what I’m going for.

I care more about the Great Wheel Cosmology than I do about game systems. I run a Pathfinder 1e game (which I know does not support the Great Wheel) and will bend whatever I find into Pathfinder 1e. That’s why I have not added a dnd-5e nor Pathfinder 1e tag here.

Does Blink work in the outer planes?

Does Blink work in the outer planes? The spell it states:

you vanish from your current plane of existence and appear in the Ethereal Plane

as well as:

While on the Ethereal Plane, you can see and hear the plane you originated from, which is cast in shades of gray, and you can’t see anything there more than 60 feet away

This seems to be written in particular contrast to the Etherealness spell (see also Can you become Ethereal in the Outer Planes?), which says:

This spell has no effect if you cast it while you are on the Ethereal Plane or a plane that doesn’t border it, such as one of the Outer Planes.

This seems to imply that it will work fine on the Outer Planes, but does it?

Amenability of the group of outer automorphisms of a connected compact Lie group

Forgive my ignorance on the Lie theory. I have the following questions in my current work concerning a certain property of compact connected Lie groups.

First, allow me to fix some notations. Let $ G$ be a connected compact Lie group, $ \mathfrak{g}$ its Lie algebra. Then $ \operatorname{Aut}(G)$ , the group of (smooth) automorphisms of the $ G$ , is a closed subgroup of $ \operatorname{Aut}(\mathfrak{g})$ , hence is a Lie group itself. Let $ \operatorname{ad} : G \to \operatorname{Aut}(G) \subseteq \operatorname{Aut}(\mathfrak{g})$ be the adjoint representation and denote its image by $ \operatorname{Inn}(G)$ , and needless to say, $ \operatorname{Inn}(G)$ is a normal subgroup of $ \operatorname{Aut}(G)$ . We denote the quotient group $ \operatorname{Aut}(G) / \operatorname{Inn}(G)$ by $ \operatorname{Out}(G)$ , and this is what I mean when I say the group of outer automorphisms in the title.

Question A. When $ \operatorname{Out}(G)$ is countable, is $ \operatorname{Inn}(G)$ always open in $ \operatorname{Aut}(G)$ ?

More generally, although this seems to have a higher chance to have a negative answer, one can ask the following question, which I suspect is still true:

Question B. Is $ \operatorname{Inn}(G)$ always open in $ \operatorname{Aut}(G)$ ? If Question A has an affirmative answer, this is equivalent to ask if $ \operatorname{Out}(G)$ is always countable.

Question C. When $ \operatorname{Inn}(G)$ is open in $ \operatorname{Aut}(G)$ , is $ \operatorname{Out}(G)$ (which now a countable discrete group) always amenable as a locally compact group?

A little experiment on the abelian case of the $ n$ -dimensional torus (in which case the inner automorphism group is trivial, and $ \operatorname{Aut}(T^n)$ is $ GL_n(\mathbb{Z})$ ), and the semisimple case (at least over $ \mathbb{C}$ instead of $ \mathbb{R}$ , which implies $ \operatorname*{Out}(G)$ being finite), seems to make a negative answer to the above questions not completely trivial. Although I am happy that the abelian case and the semisimple case already suffice for the purpose of my current work, which only needs $ \operatorname{Out}(G)$ to be amenable, I would be very interested if one can prove or disprove the amenability of $ \operatorname*{Out}(G)$ for a general compact connected Lie group $ G$ .