A flag (indicator) that shows for each row which conditions was used to select it

Suppose I have the table foo. I want to filter the rows of this table using different conditions (cond_1, cond_2, …, cond_nthe order is important) combined in a disjunction, i.e.:

SELECT * FROM foo WHERE cond_1 OR cond_2 OR ... OR cond_n; 
  1. Is it possible (in PostgreSQL 13) to distinguish for each row which condition cond_i was used to select it? Since I stated that the order is important the question may be reformulated as – I want to know the first cond_i that selected the row, for each row.

Now consider that I have in foo a column for this purpose, e.g. selected_by.

  1. Is it possible to distinguish for each row which condition cond_i was used to select it and store it in selected_by? (the same as 1st question but for an UPDATE statement)

Two things are important: the order of conditions (as it was highlighted earlier); performance (i.e. table foo may have many rows, the number of conditions is small, up to 5-10).

Evocation Wizard’s Sculpt Spell Ability with spells that persist over time – under what conditions is protection maintained?

One of my current players has the first Wizard Evoker for whom I have GMed.

His PC’s Sculpt Spells ability was easy to interpret at lower levels, when his evocation spells, like thunderwave and fireball, were instantaneous.

As he advances, however, he may obtain spells that have longer durations, such as Storm Sphere, Wall of Ice, or Whirlwind. I am realizing that I do not know how to adjudicate Sculpt Spell with spells that persist, especially when the initial conditions of the Sculpt Spell ability no longer apply.

Sculpt Spells says:

Beginning at 2nd level, you can create pockets of relative safety within the effects of your evocation spells. When you cast an evocation spell that affects other creatures that you can see, you can choose a number of them equal to 1 + the spell’s level. The chosen creatures automatically succeed on their saving throws against the spell, and they take no damage if they would normally take half damage on a successful save.

Storm Sphere, for example, has a a duration of Concentration (up to 1 minute) and says in part:

Each creature in the sphere when it appears or that ends its turn there must succeed on a Strength saving throw or take 2d6 bludgeoning damage.

To use the Sculpt Spell ability, the Evoker must see the creatures he is designating as being protected at the time he casts the Storm Sphere, and they must be in the area of the sphere at the time he casts it. It is clear that designating the protected creatures happens "when you cast".

What is not clear to me is whether the protection is for just the first round ("when you cast") or is meant to persist and provide protection on subsequent rounds.

If the protection normally persists, can it be lost if the creatures no longer meet the conditions that were required for them to be designated as protected?

What would happen to a protected creature if it was to exit the area of the Sphere and later re-enter?

Does the Evoker need to maintain them in his sight to maintain their protection? If they were originally protected when the spell was cast, but later became invisible, would it end their protection if the Evoker could no longer see them?

It is possible that reviewers may mark this as asking multiple questions. To be clear, I see all of these as examples of one question – Under what conditions does the protection afforded by Sculpt Spell persist or not persist over time?

Under what conditions does a Martial Spellcaster need the Warcaster feat to comfortably cast spells?

I had a player recently come to me about playing an Eldritch Knight character, and they had questions about their ability to cast spells while holding a weapon (or two), and were debating taking the Warcaster feat (PHB, 170) to mitigate specifically those issues. At my table, I try to take the somatic/material component requirements of spells seriously, so I want to make sure I have a grasp of what can or cannot be done when a spellcaster holding weapons tries to cast a spell, or return to attacking after having cast a spell.

One thing I’m especially interested in is the degree to which the character can "comfortably" do the actions listed. "Comfortably" in this context means that the character isn’t taking certain actions which might be technically legal according to the rules of the game, but which might inconvenience them under common circumstances. A common example is a Two Weapon Fighting character who drops a weapon to the ground to grab their spellcasting focus for casting; if they have to move, they risk leaving their weapon behind on the ground, so from my perspective, this wouldn’t qualify as a "comfortable" maneuver.

So, for the following builds, under what conditions is the character able to cast spells, and to what degree does the Warcaster feat improve their ability to do so?

  • Holding a one-handed weapon
  • Holding two one-handed weapons
  • Holding a one-handed weapon and Shield (neither Cleric nor Paladin)
  • Holding a one-handed weapon and Shield (Cleric or Paladin)
    • I’m separating these two out because Clerics and Paladins both get the ability to affix a Holy Symbol to their shield and therefore use their Shield as they would a Material Component. So I think the answer to this question is necessarily different depending on whether the spellcaster is a paladin or an Eldritch Knight, for example.
  • Holding a two-handed weapon

Under what conditions can a ghost attune to a magic item?

A ghost can possess people (‘humanoids’). It can also go onto the Border Etherial, phasing between two planes of existence. This means its interaction with physical objects varies based on where it has gone plane-wise and who it is ‘inside’, person-wise.

Attunement requires a very specific process:

Attuning to an item requires a creature to spend a Short Rest focused on only that item while being in physical contact with it (this can’t be the same short rest used to learn the item’s properties). This focus can take the form of weapon practice (for a weapon), meditation (for a wondrous item), or some other appropriate activity. If the Short Rest is interrupted, the attunement attempt fails. Otherwise, at the end of the Short Rest, the creature gains an intuitive understanding of how to activate any magical properties of the item, including any necessary Command words.

It is not clear who is touching things while one is doing Possession. The ghost is using the person ‘as a puppet’. By holding a magic knife with a puppet one is NOT touching the knife at all. Yet, if arrested, pointing out ‘the magic knife is attuned to the puppet!!’ does not help much. After all possession is 9/10ths of the law.


Question repeat: Can a ghost attune to a magic item? If so, under what conditions?

MySQL – multiple counts on relations based on conditions – JOIN VS. SUBQUERY

I don’t want to share my exact DB structure, so let’s assume this analogy :

--categories-- id name  --products-- id name cat_id 

I then have SQL like this :

SELECT categories.*, count(CASE WHEN products.column1=something1 and products.column2=something2 THEN 1 END) as count1, count(CASE WHEN products.column3=something3) as count2  FROM categories LEFT JOIN products ON products.cat_id=categories.id GROUP BY categories.id 

The problem here is that the GROUP BY is taking too long, it’s a difference between 0.2s query and 2.5s query.

Selecting a record based off conditions CLOB

I have a table with a column storing JSON data as a CLOB. The JSON has a ‘miscData’ field that is made up of an array of JSON objects. Each object has 2 keys which are always the same, but the values are different.

. . . "otherKeys" : "otherValues", "miscData": [         {             "miscType": "date",             "miscText": "2020-07-09T10:01:10.450Z"         },         {             "miscType": "Comment",             "miscText": "Comment body"         },         {             "miscType": "CORRECT_TYPE",             "miscText": "SELECT_ME"         }     ], "confirmationNumber" : "123456789qwerty", . . . 

I need to

SELECT      CLOB_COL.miscData.miscText  WHERE     CLOB_COL.miscData.miscType = 'CORRECT_TYPE'  AND      CLOB_COL.confirmationNumber = 'xxxx'; 

But I am having trouble since miscData is an array of objects which all contain miscType and miscData keys and I can’t guarantee the array will be the same size, or in the same order.

Are Familiars affected by weather conditions? [closed]

Since a familiar is a magical spirit (celestial/fey/fiend, albeit in a physical form), does it have any restrictions to travel in cold/hot areas for scouting purposes, or altitude of mountain air? I’m trying to use my owl familiar to scout mountains, and my DM tells me that it’s too cold and/or high for him to be able to scout. Would I have to recast and change the species of the owl to snowy, or would being a celestial owl prevent having to do this? Obviously if its too hot they burn and die, and if it gets too cold they freeze, but as a magical spirit that can travel between dimensions, where should the line be drawn? The 3e/3.5e template is way overpowered (spell resistance, etc), but this feels almost entirely too weak. How limited is a familiar by their physical form if they’re no longer considered a "beast?"

Attack Spells & Conditions

In D&D5e, if a monster has a Condition, say Stunned, which gives the following bonus…

Attack rolls against the creature have advantage.

… does this benefit also apply to Spells that require "melee/ranged spell attack" rolls to hit?

Being a newbie, can’t seem to find anything solid in the rulebooks!