postgresql – Create dynamic sql query to select all related data in DB based on entry table and ID

Hope all is well. I am hoping you can help me.

Problem Statement – I’m tasked to create a dynamic SQL statement which will select all related data from a given table where the Identifier is passed. For each table where the relevant data is found i would like the data to be exported onto a separate tab of within excel

If i was doing this manually done this i would perform the following queries and export the data onto each tab;

Select * from  Mason where id = 12345
Select * from  MasonContacts where Companyid= 12345 
Select * from  MasonOpportunities  where Comid = 12345 

However given the sheer volume of tables this isn’t viable.

Step 1 : Type in my identifier (in this case my identifier is a field called “Id” in the Table “Mason”) The query will always start from this table.

Table Name : Mason
Field : Id = “12345”

Step 2 : Search against table “MasonContacts”, search against the field “Companyid”. Return all columns & records where the field “Companyid = 12345”

Table Name : MasonContacts
Field : Companyid

Step 3 : Search against table “Mason Opportunities “, search against the field “Comid”. Return all columns & records where the field “Company = 12345”

Table Name : MasonOpportunities
Field : Comid

Looking forward to your help

sql server – Purposefully fail select with no where

We have an evil query that reads every row from a table, but should not. To help the devs find the source of that query, I want to make SQL Server error out when any select against that table has no where clause.


An app is doing an evil select with no where. The select reads every row of a table having about 6,500 rows. The select is fast in SSMS (< 1 second), but when run by the app it’s slow (about 1/2 hour). We think that’s because the app is slowly iterating over the result set. It’s an active table for updates and inserts, so other queries may be blocked while this read takes place.

The developers can think of no reason that any app should read every row of that table. They suspect an oversight by a past developer.

The evil query-with-no-where is my top-runner, by far, for having the longest total duration in Query Store.

I know which app is issuing the evil query by using SQL Profiler to identify the app name, host name, and DB user name. The app’s developers have been unable to locate the source of the evil query. I want to help.

I want to cause any select against that table that has no WHERE clause (i.e. selects every row) to fail immediately. Our hope is that the app will log the errors, or possibly an end user that triggered the activity will report a 500 error to us, and this will give us another clue to find what code is issuing the evil query-with-no-where.

Our other selects against that table have specific where clauses and only return a subset of the table’s rows. Those selects must be allowed to continue.

Can the particle system in Unity select sprites from a spritesheet based on angle?

I want to create a particle system for gore effects. I have some requirements that don’t seem possible with Unity’s built-in particle system, but I want to make sure I haven’t overlooked something. So the question is, can this (the following) be done with the built-in system or will I need to implement a custom system?

I want the particles to be made of hand-drawn pixel art. The art has specific sprites drawn for the eight cardinal directions. The particle system uses an angle to choose which sprite to use.

For a blood splash effect, the particles are drops of blood. The angle of trajectory is used to select the particle’s sprite each frame.

For an explosion of bones, the particles are twirling bones. Each particle has some intrinsic rotation as well as rotational velocity. The angle of the intrinsic rotation is used to select the particle’s sprite each frame (independent of the trajectory).

Why not in does not return values with null values in my select query on postgresql 11?

I have the following sql script:

CREATE temporary table if not EXISTS the_values (
 key SERIAL,
 value INTEGER NULL 
);

insert into the_values(value) values (null),(1),(null),(2),(3),(4),(5),(6),(10),(null),(null);

select * from the_values where value not in (1,2,3,4,5,6,10); 

And I noticed that the query:

select * from the_values where value not in (1,2,3,4,5,6,10); 

Does not return the rows having value NULL, and that, caught my attention. Therefore, I want to know why that happens. I am interested more about the technical aspect of this phenomenon rather that the obvious solution:

select * from the_values where value not in (1,2,3,4,5,6,10) or value IS NULL; 

Sharepoint Online search REST api – filtering news pages on select sites

Using the search api to pull content into a mobile app, what’s the right way to filter the results to get news from 2 select sites? Is there a way to use the actual site name in the filter or does it have to be the “webId”? Here’s the url I’d like to use to illustrate what I mean:

https://xxx.sharepoint.com/_api/search/query?querytext='IsDocument:True AND FileExtension:aspx AND PromotedState:2'&selectproperties='Author,Path,Title,Url,CanvasContent1OWSHTML'&$filter=SiteTitle eq site1 or SiteTitle eq site2

Correct way with Macbook Pro trackpad to select from dropdown form?

Having started to use a MacBook Pro with Catalina a lot more than a Mac Mini, I’ve had trouble trying to negotiate the trackpad after using a mouse for so long.

I want to be able to use a dropdown / select, like this example at https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_optgroup but do not know the correct trackpad gesture for selecting it; I’ve done some light Google-ing but am unsure.

Any help is appreciated.

postgresql – Postgres 12 create table as simple select + hash join takes 8+ hours for 100GB?

I’m using a “create table as select …” statement to create a copy of a subset of the columns in a ~100GB table (400 million records). I am also performing a hash join with another table which is only 36 records. It takes 8-9 hours to perform this copy. Does that seem reasonable, or is it indicative of a problem?

The server should have plenty of disk space, 128 GB of RAM, and 16 cores.

The source table is partitioned.

automator – How to use Applescript to open a printer app and select items within?

I have absolutely no knowledge or experience in using Applescript or Automator. I’m hoping by using either to create an app (or script) that will print a test page off my printer automatically. I know how to open the printer app (Canon iX6800 series.app), but I’m stuck from there with the dialog box not knowing how to continue to do the following steps:

  1. Run “Canon iX6800 series” – I got this part…
  2. Select “Settings” or Command S
  3. Select “Utility”
  4. Select “Print Test Page”
  5. Click “OK”
  6. Quit the app.

Any suggestions or help will be greatly appreciated. I can send the actual app to whoever might need it. Thanks in advance.
George

Google Sheets search and select from Database

i’m trying to make a advanced search but i’m stuck at all. I tried it with =SVERWEIS and also with INDEX but failed.

I hope the doc explains enough what I wanna try to do but failed at all. My knowlege isn’t that bad but here I need help. Would be nice if someone could help me with this.

https://docs.google.com/spreadsheets/d/1BGFzntBg-YHcRHM0qChFg9yoLahoOTUehoV3_9DY9PU/edit?usp=sharing

This is the doc and can be edited.

Thanks for your time reading my bad english post. :]