问:
AWS CloudFront multiple-origins with multiple-behaviors
I want to use a single AWS CloudFront CDN distribution to serve both production and development content with different behaviors for each.

I have production and development content in one bucket.

```<code>bucket
   |-- root
      |-- p
         |-- demo.html
      |-- d
         |-- v1
            |-- demo.html
</code>```

The aim is to serve the production files from the root and the dev files from a path with directories.
my.domain.com/demo.html and my.domain.com/d/v1/demo.html

I have two origins:

1 - Origin: wm-prod. Origin domain: wm-bucket. Origin path /root/p

2 - Origin: wm-dev. Origin domain: wm-bucket. Origin path /root/d

and two behaviors:

1 - Behavior precedence: 1. Path pattern Default (*). Origin wm-prod

2 - Behavior precendence: 0. Path pattern /d. Origin wm-dev

I tried /d/*, d/, d/*, and even simply d as the path pattern. I've also tried using /dev so the origin path and url path pattern are different. No luck in either case.

Expected behavior is that when someone visits the root (my.domain.com/demo.html) the production file is loaded thanks to the first origin path of /root/p. This works as expected. Expected behavior also includes visitors who visit a URL with the path pattern that matches /d (my.domain.com/d/v1/demo.html) seeing content from the second origin whose origin path is /root/d. This is not working as expected.

In all cases in which it's "not working" the standard S3 message for an unfound file is returned. "This XML file does not appear...."

A workaround to skip the multiple behaviors to simply include /p in the URL of the production content (my.domain.com/p/demo.html). This is what I have in place to proceed, however, it would be preferred to use the root path.

Is it possible to achieve what I'm seeking?

Thank you!

Body:
I want to use a single AWS CloudFront CDN distribution to serve both production and development content with different behaviors for each.

I have production and development content in one bucket.

bucket
   |-- root
      |-- p
         |-- demo.html
      |-- d
         |-- v1
            |-- demo.html

The aim is to serve the production files from the root and the dev files from a path with directories.
my.domain.com/demo.html and my.domain.com/d/v1/demo.html

I have two origins:

1 - Origin: wm-prod. Origin domain: wm-bucket. Origin path /root/p

2 - Origin: wm-dev. Origin domain: wm-bucket. Origin path /root/d

and two behaviors:

1 - Behavior precedence: 1. Path pattern Default (*). Origin wm-prod

2 - Behavior precendence: 0. Path pattern /d. Origin wm-dev

I tried /d/*, d/, d/*, and even simply d as the path pattern. I've also tried using /dev so the origin path and url path pattern are different. No luck in either case.

Expected behavior is that when someone visits the root (my.domain.com/demo.html) the production file is loaded thanks to the first origin path of /root/p. This works as expected. Expected behavior also includes visitors who visit a URL with the path pattern that matches /d (my.domain.com/d/v1/demo.html) seeing content from the second origin whose origin path is /root/d. This is not working as expected.

In all cases in which it's "not working" the standard S3 message for an unfound file is returned. "This XML file does not appear...."

A workaround to skip the multiple behaviors to simply include /p in the URL of the production content (my.domain.com/p/demo.html). This is what I have in place to proceed, however, it would be preferred to use the root path.

Is it possible to achieve what I'm seeking?

Thank you!


来源: stackexchange

问:
Change WooCommerce Status Based On Payment Method Interac (etransfer)
I want when a customer chooses to pay through Email Transfer (Interac) to go ahead and set the order status to Pending etransfer.

– My custom gateway name is custom_b9599316cc4fd28.
– My custom status slug is pending-etransfer.

```<code>add_action( 'woocommerce_order_status_changed', 'woocommerce_payment_complete_order_status', 10, 3 );
function woocommerce_payment_complete_order_status( $order_id ) {
    if ( ! $order_id ) {
        return;
    }

    $order = wc_get_order( $order_id );

    if ( $order->data['status'] == 'processing' ) {
        $payment_method = $order->get_payment_method();

        if ( $payment_method != 'custom_b9599316cc4fd28' ) {
            $order->update_status( 'pending-etransfer' );
        }
    }
}
</code>```

Any help is greatly appreciated.

The code as you see it.

ContentLicense: CC BY-SA 4.0

Body:
I want when a customer chooses to pay through Email Transfer (Interac) to go ahead and set the order status to Pending etransfer.

– My custom gateway name is custom_b9599316cc4fd28.
– My custom status slug is pending-etransfer.

add_action( 'woocommerce_order_status_changed', 'woocommerce_payment_complete_order_status', 10, 3 );
function woocommerce_payment_complete_order_status( $order_id ) {
    if ( ! $order_id ) {
        return;
    }

    $order = wc_get_order( $order_id );

    if ( $order->data['status'] == 'processing' ) {
        $payment_method = $order->get_payment_method();

        if ( $payment_method != 'custom_b9599316cc4fd28' ) {
            $order->update_status( 'pending-etransfer' );
        }
    }
}

Any help is greatly appreciated.

The code as you see it.


问:
Unable to run the same task in cypress
I'm having a problem with Cypress and the task API. It only works once when I'm trying to run the same cy.task in two different test scripts.

Context:

Let's assume we have this file tree:

```<code>cypress/integration/
└── user
   ├── list.js
   └── profile
       └── id.js
</code>```

Inside the "list.js" file I'm running a cy.task script to populate the database with user data .

When all the tests are done, I want to clear the database and repopulate the user data for testing the "id.js" file. But it just won't work, I don't get any errors or something that would point me in the right direction.

To debug the situation I inserted a console.log in the script to populate the DB. The result was as expected, the console.log displayed only for the "list" script, but for the "id" script, not.

This is all the data I'm having, if anybody needs more information, please do tell me.

Title: Unable to run the same task in cypress

Body:
I'm having a problem with Cypress and the task API. It only works once when I'm trying to run the same cy.task in two different test scripts.

Context:

Let's assume we have this file tree:

cypress/integration/
└── user
   ├── list.js
   └── profile
       └── id.js

Inside the "list.js" file I'm running a cy.task script to populate the database with user data .

When all the tests are done, I want to clear the database and repopulate the user data for testing the "id.js" file. But it just won't work, I don't get any errors or something that would point me in the right direction.

To debug the situation I inserted a console.log in the script to populate the DB. The result was as expected, the console.log displayed only for the "list" script, but for the "id" script, not.

This is all the data I'm having, if anybody needs more information, please do tell me.


问:
Font Awesome light macro type error unit test
Not able to select the font awesome 6 icon in the jest unit test. Throws the error given below.
Any idea how to mock the light function from the module ?</p>
```<code>TypeError: (0 , import_macro_1.light) is not a function

     31 |                     <Tooltip title="Execute Basket Order Pre-Trade" placement="top" disableInteractive>
     32 |                         <span>
   > 33 |                             <FontAwesomeIcon color="#26b7cd" className="cursor-pointer basket-grid-execute" fontSize="20px" fontWeight="300" icon={light('play')} />
        |                                                                                ^
     34 |                         </span>
     35 |                     </Tooltip>
     36 |                     <Tooltip title="Edit Basket Row" placement="top" disableInteractive>
</code>```

Body:
Not able to select the font awesome 6 icon in the jest unit test. Throws the error given below.
Any idea how to mock the light function from the module ?

TypeError: (0 , import_macro_1.light) is not a function

     31 |                     <Tooltip title="Execute Basket Order Pre-Trade" placement="top" disableInteractive>
     32 |
   > 33 |                             <FontAwesomeIcon color="#26b7cd" className="cursor-pointer basket-grid-execute" fontSize="20px" fontWeight="300" icon={light('play')} />
        |                                                                                ^
     34 |
     35 |                     </Tooltip>
     36 |                     <Tooltip title="Edit Basket Row" placement="top" disableInteractive>


问:
Correct way to keep track of an array of Toggle Button States?
I am generating constant 4 element array of styled mui Toggle Buttons in this form:

```<code>{qualityValues.map(({key, value}) => (
            <Grid item xs={6}>
            <StyledToggleButton
                props
                defaultState={value.defaultState}
                key={key}
            />
        </Grid>
        ))}
</code>```

And the button itself is created like so:

```<code>function StyledToggleButton(props) {
const [selected, setSelected] = React.useState(props.defaultState);

return (

    <StyledToggleButton_
        props
        selected={selected}
        onChange={() => {
            setSelected(!selected);
        }}
    >
        {props.text}
    </StyledToggleButton_>
)}
</code>```

Now I'd like to keep track of which buttons are toggled on in a single array. Initially I did this with array comprehension but found it to struggle keeping states accurately. I think the correct way to go about it is to return an {selected, render : {}} object from my StyledToggleButton component but I can't seem to get it all to harmonize. Additionally, I suspect I can use React.Children on my parent Grid in some clever way but I don't have a grasp on how or where to use it. How can I cleanly implement this?

Body:
I am generating constant 4 element array of styled mui Toggle Buttons in this form:

{qualityValues.map(({key, value}) => (
            <Grid item xs={6}>

)}

Now I'd like to keep track of which buttons are toggled on in a single array. Initially I did this with array comprehension but found it to struggle keeping states accurately. I think the correct way to go about it is to return an {selected, render : {}} object from my StyledToggleButton component but I can't seem to get it all to harmonize. Additionally, I suspect I can use React.Children on my parent Grid in some clever way but I don't have a grasp on how or where to use it. How can I cleanly implement this?


问:
How to disallow query strings in robots.txt
I have following URLs with query parameters:

```<code>1- https://www.example.com/en/project-information?products_of_interest__c=EVK
2- https://www.example.com/en/sales-network?office_type=commercial
3- https://example.com/en/product-selector?category=Services
4- https://www.example.com/en/product-selector?form_factor=JODY
</code>```

I want to disallow indexing on above query parameters and I have written following format to disallow above pages that starts with query parameters:

```<code>Disallow: /*?products_of_interest__c=*
Disallow: /*?office_type=*
Disallow: /*?category=*
Disallow: /*?form_factor=*
</code>```

Are the above in the right format to meet my requirement?

Body:
I have following URLs with query parameters:

1- https://www.example.com/en/project-information?products_of_interest__c=EVK
2- https://www.example.com/en/sales-network?office_type=commercial
3- https://example.com/en/product-selector?category=Services
4- https://www.example.com/en/product-selector?form_factor=JODY

I want to disallow indexing on above query parameters and I have written following format to disallow above pages that starts with query parameters:

Disallow: /*?products_of_interest__c=*
Disallow: /*?office_type=*
Disallow: /*?category=*
Disallow: /*?form_factor=*

Are the above in the right format to meet my requirement?


问:
How do I move 2 turtle shapes at the same time?
I am making a simple jump game in python, and so far have a player and a spike. The spike moves infinitely to the left of the screen and then immediately goes back to the right side. The player jumps when you press space. My issue is that I cannot have the player jumping and the sprite moving at the same time.

```<code>#Imports and other setup
import turtle
import time
turtle.speed(5)
air = 0

#Window customization
wn = turtle.Screen()
wn.title('Jump Game')
wn.bgcolor('black')
wn.setup(width=600, height=600)

#Player creation
player = turtle.Turtle()
player.penup()
player.ht()
player.shape('square')
player.color('blue')
player.goto(-200, -200)
player.st()
player.down()

#Floor creation
floorCors = ((210, -300), (210, 300), (300, 300), (300,        -300))
wn.register_shape('rectangle', floorCors)
floor = turtle.Turtle()
floor.shape('rectangle')
floor.color('white')

#Obstacle creation
obstacle = turtle.Turtle()
obstacle.penup()
obstacle.ht()
obstacle.shape('triangle')
obstacle.color('red')
obstacle.goto(200, -202)
obstacle.tilt(90)
obstacle.st()
obstacle.down()
turtle.update()

#Player jump
def jump():
    global air
    if air == 0:
        air = 1
        player.penup()
        player.speed(1)
        y = player.ycor()
        player.sety(y+100)
        player.sety(y-0)
        air = 0

wn.listen()
wn.onkeypress(jump, 'space')

#Obstacle movement
while True:
    obstacle.penup()
    obstacle.speed(3)
    x = obstacle.xcor()
    if x > -300:
        obstacle.goto(x-10, -202)
    else:
        obstacle.ht()
        obstacle.speed(0)
        obstacle.goto(300, -202)
        obstacle.speed(3)
        obstacle.st()
</code>```

I thought about combining the two movement chunks but I have no idea how to approach that.

Body:
I am making a simple jump game in python, and so far have a player and a spike. The spike moves infinitely to the left of the screen and then immediately goes back to the right side. The player jumps when you press space. My issue is that I cannot have the player jumping and the sprite moving at the same time.

#Imports and other setup
import turtle
import time
turtle.speed(5)
air = 0

#Window customization
wn = turtle.Screen()
wn.title('Jump Game')
wn.bgcolor('black')
wn.setup(width=600, height=600)

#Player creation
player = turtle.Turtle()
player.penup()
player.ht()
player.shape('square')
player.color('blue')
player.goto(-200, -200)
player.st()
player.down()

#Floor creation
floorCors = ((210, -300), (210, 300), (300, 300), (300,        -300))
wn.register_shape('rectangle', floorCors)
floor = turtle.Turtle()
floor.shape('rectangle')
floor.color('white')

#Obstacle creation
obstacle = turtle.Turtle()
obstacle.penup()
obstacle.ht()
obstacle.shape('triangle')
obstacle.color('red')
obstacle.goto(200, -202)
obstacle.tilt(90)
obstacle.st()
obstacle.down()
turtle.update()

#Player jump
def jump():
    global air
    if air == 0:
        air = 1
        player.penup()
        player.speed(1)
        y = player.ycor()
        player.sety(y+100)
        player.sety(y-0)
        air = 0

wn.listen()
wn.onkeypress(jump, 'space')

#Obstacle movement
while True:
    obstacle.penup()
    obstacle.speed(3)
    x = obstacle.xcor()
    if x > -300:
        obstacle.goto(x-10, -202)
    else:
        obstacle.ht()
        obstacle.speed(0)
        obstacle.goto(300, -202)
        obstacle.speed(3)
        obstacle.st()

I thought about combining the two movement chunks but I have no idea how to approach that.


问:
Optimization problems when migrating a function from MS SQL to Postgres
I moved the function to Postgres. In MS SQL, it was executed in less than a second. In Postgresql, it runs for almost 6 minutes. I've been working on this problem for 6 hours, and I haven't found a reason. As I understand it, the problem is in the syntax.

In the xt_ed_registr_grp_led function, I attach the function (xt_ef_registr_pts_all) to a table in this format:

```<code>LEFT JOIN dbo.xt_ef_registr_pts_all(_D_Date, -1, NULL) AS RP_Child
                                    ON RP_Child.link = RG.f_registr_pts
</code>```

Next, I attach the code from MS SQL and Postgres.

Postgres function

```...
AS
$$
BEGIN

    RETURN QUERY SELECT
                     RP.link,
                     RP.f_division,
                     RP.f_subdivision,
                     RP.f_subscr,
                     RP.f_sale_items,
                     RP.f_sale_category,
                     RP.d_date_begin,
                     RP.d_date_end,
                     RCap.f_work_modes AS F_Work_Modes,
                     RP.f_energy_levels,
                     NP.f_conn_points,
                     NP.c_address_short,
                     CASE
                         WHEN COALESCE(Provinces.c_name, '') = ''
                             THEN NULL
                         ELSE LTRIM(RTRIM((COALESCE(LT_Provinces.c_prefix || ' ', '') || COALESCE(Provinces.c_name, ''))))
                     END AS C_Provinces,
                     CASE
                         WHEN COALESCE(Towns.c_name, '') = ''
                             THEN NULL
                         ELSE LTRIM(RTRIM((COALESCE(LT_Towns.c_prefix || ' ', '') || COALESCE(Towns.c_name, ''))))
                     END AS C_Towns,
                     CASE
                         WHEN COALESCE(Municipalities.c_name, '') = ''
                             THEN NULL
                         ELSE LTRIM(RTRIM((COALESCE(LT_Municipalities.c_prefix || ' ', '') || COALESCE(Municipalities.c_name, ''))))
                     END AS C_Municipalities,
                     CASE
                         WHEN LTRIM(RTRIM(((COALESCE(LT_Streets.c_prefix || ' ', '') || COALESCE(Streets.c_name, '')) || COALESCE(', ' || CP.c_building_num, '') ||
                                           COALESCE(COALESCE(' ' || sbct.c_short_name, ' ' || sbct.c_name, '/') || CP.c_building_corp, '')))) = ''
                             THEN NULL
                         ELSE LTRIM(RTRIM(((COALESCE(LT_Streets.c_prefix || ' ', '') || COALESCE(Streets.c_name, '')) || COALESCE(', ' || CP.c_building_num, '') ||
                                           COALESCE(COALESCE(' ' || sbct.c_short_name, ' ' || sbct.c_name, '/') || CP.c_building_corp, ''))))
                     END AS C_Street_Building,
                     RCM.f_calc_methods,
                     RCM.d_date AS D_Calc_Methods_Date,
                     CASE
                         WHEN EXISTS(SELECT
                                         0
                                     FROM dbo.ed_registr_grp RG1
                                     WHERE RG1.f_registr_pts_main = RP.link
                             )
                             THEN TRUE
                         ELSE FALSE
                     END AS B_Group,
                     CASE
                         WHEN EXISTS(SELECT
                                         0
                                     FROM dbo.ed_registr_grp RG1
                                     WHERE RG1.f_registr_pts = RP.link
                             )
                             THEN TRUE
                         ELSE FALSE
                     END AS B_IncludeGroup,
                     dbo.xt_ef_registr_pts_energy_categ(RP.f_sale_items, RP.f_tariff, RP.f_energy_levels) AS F_Energy_Category,
                     RP.f_registr_pts_prev,
                     D.link AS F_Device,
                     EDP.f_division AS f_device_division,
                     D.n_rate,
                     D.n_rate * dbo.ui_ef_device_transf_rate(D.f_division, D.link, COALESCE(_D_Date, NOW())) AS N_Ktf,
                     Dig.c_digits,
                     EDC.c_name AS C_Device_Category_Name,
                     EDC.f_class,
                     D.f_device_types,
                     D.c_serial_number,
                     EDP.f_energy_types,
                     EDP.n_percent2,
                     EDP.b_main AS B_Device_Main,
                     D.d_setup_date,
                     D.d_replace_date,
                     EDP.n_percent,
                     RPT.f_tariff,
                     RPT.d_date::timestamptz(0)::text AS D_Tariff_Date,
                     RPT.f_norms,
                     RCon.n_cons AS N_Cons_Cons,
                     RCon.n_cons2 AS N_Cons_Cons2,
                     RCon.d_date AS D_Cons_Date,
                     RCap.n_cap AS N_Cap_Cons,
                     RCap.n_cap2 AS N_Cap_Cons2,
                     RCap.n_cap3 AS N_Cap_Cons3,
                     RCap.d_date AS D_Cap_Date,
                     RPA.n_rate AS N_Activity_Rate,
                     RPA.d_date AS D_Activity_Date,
                     RP.c_code AS n_code,
                     RP.c_name,
                     RP.f_balance_types,
                     RP.f_balance_type_details,
                     RP.f_balance_types_sec,
                     RP.f_balance_type_details_sec,
                     RP.n_order,
                     RP.b_non_heat_formula,
                     RP.b_line_formula,
                     RP.b_transf_formula,
                     RP.f_transf_types,
                     SDA.link AS F_Areas,
                     erpa.d_date AS D_Areas_Date,
                     RP.b_notinclude,
                     RP.f_form_46,
                     RP.f_cons_category,
                     RP.s_owner,
                     RP.s_create_date,
                     RP.s_modif_date,
                     RP.s_creator,
                     NP.link AS F_Network_Pts,
                     NP.c_code AS C_Network_Pts_Code,
                     NR.c_network_path AS _Bound_F_Network_Pts,
                     NR.c_network_path_short AS C_Network_Path_Short,
                     CASE
                         WHEN NIP.f_parent IS NOT NULL
                             THEN dbo.cf_get_network_name(COALESCE(NI_P.f_networks, NI.f_networks))
                     END AS _Bound_F_Network,
                     FSI.c_name AS _Bound_F_Sale_Items,
                     EDT.c_name || COALESCE(' / ' || EDT.c_modification, '') AS _Bound_F_Device_Types,
                     (dbo.cf_get_c_codename(FT.n_code, FT.c_name) || ' / ' || CAST(COALESCE(FTH.n_tariff, '0') AS text) || 'р.') AS _Bound_F_Tariff,
                     FTH.n_tariff AS N_Tariff1,
                     FTH.n_tariff_2 AS N_Tariff2,
                     EEL.c_name AS _Bound_F_Energy_Levels,
                     ECM.c_name || COALESCE(' / ' || ECM2.c_name, '') AS _Bound_F_Calc_Methods,
                     COALESCE(EBT.c_short_name, EBT.c_name) AS _Bound_F_Balance_Types,
                     COALESCE(EET.c_short_name, EET.c_name) AS _Bound_F_Energy_Types,
                     ESWM.c_name AS _Bound_F_Work_Modes,
                     ELA.c_name AS _Bound_F_Transf_Algorithms,
                     ELA2.c_name AS _Bound_F_Line_Algorithms,
                     ELA3.c_name AS _Bound_F_Non_Heat_Algorithms,
                     SDA.c_name AS _Bound_F_Areas,
                     CP.c_code_cp AS N_Conn_Points_Code,
                     COALESCE(CP.c_name, NP.c_address_short) AS C_Conn_Points_Name,
                     COALESCE(CPS.c_name, '') || COALESCE(' ' || CT.c_name_short, '') || COALESCE(' № ' || CPS.c_premise_number, '') AS C_Conn_Points_Sub_Name,
                     CPS.c_premise_number AS C_Premise_Number,
                     COALESCE((CPS.j_custom ->> 'j_b_dryers')::bool, (CP.j_custom ->> 'j_b_dryers')::bool) AS B_Polotenchik,
                     COALESCE((CPS.j_custom ->> 'j_b_riser_insulation')::bool, (CP.j_custom ->> 'j_b_riser_insulation')::bool) AS B_Isolation,
                     COALESCE((CPS.j_custom ->> 'j_b_external_gvs')::bool, (CP.j_custom ->> 'j_b_external_gvs')::bool) AS B_OuterGVS,
                     CP.f_conn_types AS F_Conn_Types,
                     CP.f_conn_status_types AS F_Conn_Status_Types,
                     FSC.c_name AS _Bound_F_Sale_Category,
                     ETT.c_name AS _Bound_F_Transf_Types,
                     FN.c_name AS _Bound_F_Norms,
                     dbo.cf_get_network_name(COALESCE(NI_P.f_networks, NI.f_networks)) AS C_Network_Path,

                     RP.n_graph_form,
                     RP.n_line_loss,
                     RP.n_rp_loss,

                     NP.f_conn_points_sub,

                     RPL_Non_Heat.d_date_begin AS D_Non_Heat_Date,
                     RPL_Non_Heat.n_value AS N_Non_Heat_Waste,
                     RPL_Non_Heat.f_loss_algorithms AS F_Non_Heat_Algorithms,
                     RPL_Line.d_date_begin AS D_Line_Date,
                     RPL_Line.n_value AS N_Line_Waste,
                     RPL_Line.f_loss_algorithms AS F_Line_Algorithms,
                     RPL_Transf.d_date_begin AS D_Transf_Date,
                     RPL_Transf.n_value AS N_Transf_Waste,
                     RPL_Transf.f_loss_algorithms AS F_Transf_Algorithms,

                     s.n_code AS N_Code_Subscr,
                     p.c_name1 AS C_Name_Subscr

                 FROM dbo.ed_registr_pts AS RP

                      LEFT JOIN dbo.sd_subscr AS s
                                ON s.link = RP.f_subscr
                      LEFT JOIN dbo.cd_partners AS p
                                ON p.link = s.f_partners

                      LEFT JOIN dbo.ed_network_pts AS NP
                                ON NP.link = RP.f_network_pts
                               AND NP.b_pod = TRUE
                      LEFT JOIN LATERAL
                      (   SELECT
                              NIPX.link,
                              NIPX.f_parent
                          FROM dbo.ed_network_struct NIPX
                          WHERE NIPX.f_child = NP.link
                            AND NIPX.b_pod = TRUE
                            AND NIPX.b_ismain = TRUE
                            AND NIPX.d_date_begin <= COALESCE(_D_Date, NOW())
                          ORDER BY
                              NIPX.d_date_begin DESC
                          LIMIT 1
                      ) AS NIP
                      ON TRUE

                      LEFT JOIN LATERAL
                      (
                          SELECT
                              NIPX.link,
                              NIPX.f_parent
                          FROM dbo.ed_network_struct NIPX
                          WHERE NIPX.f_child = NP.f_network_pts
                            AND NIPX.b_pod = TRUE
                            AND NIPX.b_ismain = TRUE
                            AND NIPX.d_date_begin <= COALESCE(_D_Date, NOW())
                          ORDER BY
                              NIPX.d_date_begin DESC
                          LIMIT 1
                      ) AS NIP_P
                      ON TRUE

                      LEFT JOIN LATERAL
                      (
                         SELECT
                             NRi.id,
                             NRi.c_network_path,
                             NRi.c_network_path_short
                         FROM dbo.ed_network_routes NRi
                         WHERE NRi.n_level = 0
                           AND NRi.link = COALESCE(NIP_P.f_parent, NIP.f_parent)
                           AND NOW() >= NRi.d_date0
                           AND NOW() < NRi.d_date1
                         ORDER BY
                             NRi.n_rate,
                             NRi.d_date1,
                             NRi.b_main DESC
                         LIMIT 1
                      ) AS NR
                      ON TRUE

                      LEFT JOIN dbo.ed_network_pts NI
                                ON NI.link = NIP.f_parent
                               AND NI.b_pod = FALSE

                      LEFT JOIN dbo.ed_network_pts NI_P
                                ON NI_P.link = NIP_P.f_parent
                               AND NI_P.b_pod = FALSE

                     /* Объект и адрес */
                      LEFT JOIN dbo.sd_conn_points CP
                                ON CP.link = NP.f_conn_points
                      LEFT JOIN dbo.sd_conn_points_sub CPS
                                ON CPS.link = NP.f_conn_points_sub
                      LEFT JOIN dbo.cs_conn_types CT
                                ON CT.link = CPS.f_conn_types
                      LEFT JOIN dbo.ss_building_corp_type sbct
                                ON sbct.link = CP.f_building_corp_type
                      LEFT JOIN dbo.ss_locations AS Provinces
                                ON Provinces.link = CP.f_provinces_fias
                      LEFT JOIN dbo.ss_location_types AS LT_Provinces
                                ON LT_Provinces.link = Provinces.f_location_types
                      LEFT JOIN dbo.ss_locations AS Towns
                                ON Towns.link = CP.f_towns_fias
                      LEFT JOIN dbo.ss_location_types AS LT_Towns
                                ON LT_Towns.link = Towns.f_location_types
                      LEFT JOIN dbo.ss_locations AS Municipalities
                                ON Municipalities.link = CP.f_municipalities_fias
                      LEFT JOIN dbo.ss_location_types AS LT_Municipalities
                                ON LT_Municipalities.link = Municipalities.f_location_types
                      LEFT JOIN dbo.ss_locations AS Streets
                                ON Streets.link = CP.f_streets_fias
                      LEFT JOIN dbo.ss_location_types AS LT_Streets
                                ON LT_Streets.link = Streets.f_location_types /* Параметры ТУ */
                      LEFT JOIN dbo.ed_registr_pts_areas AS erpa
                                ON erpa.f_registr_pts = RP.link
                               AND erpa.d_date <= COALESCE(_D_Date, NOW())
                               AND erpa.d_date_end > COALESCE(_D_Date, NOW())

                      LEFT JOIN dbo.sd_areas AS SDA
                                ON SDA.link = erpa.f_areas

                      LEFT JOIN dbo.ed_registr_pts_loss AS RPL_Line
                                ON RPL_Line.f_registr_pts = RP.link
                               AND RPL_Line.f_loss_types = 1
                               AND COALESCE(_D_Date, NOW()) BETWEEN RPL_Line.d_date_begin AND RPL_Line.d_date_end
                      LEFT JOIN dbo.ed_registr_pts_loss AS RPL_Transf
                                ON RPL_Transf.f_registr_pts = RP.link
                               AND RPL_Transf.f_loss_types = 2
                               AND COALESCE(_D_Date, NOW()) BETWEEN RPL_Transf.d_date_begin AND RPL_Transf.d_date_end
                      LEFT JOIN dbo.ed_registr_pts_loss AS RPL_Non_Heat
                                ON RPL_Non_Heat.f_registr_pts = RP.link
                               AND RPL_Non_Heat.f_loss_types = 3
                               AND COALESCE(_D_Date, NOW()) BETWEEN RPL_Non_Heat.d_date_begin AND RPL_Non_Heat.d_date_end

                      LEFT JOIN LATERAL
                      (
                          SELECT
                              RPA1.n_rate,
                              RPA1.d_date,
                              RPA1.f_registr_pts
                          FROM dbo.ed_registr_pts_activity AS RPA1
                          WHERE RPA1.f_registr_pts = RP.link
                            AND RPA1.d_date <= COALESCE(_D_Date, NOW())
                          ORDER BY
                              d_date DESC
                          LIMIT 1
                      ) AS RPA
                      ON TRUE

                      LEFT JOIN dbo.ed_registr_pts_tariff AS RPT
                                ON RPT.f_registr_pts = RP.link
                               AND COALESCE(_D_Date, NOW()) BETWEEN RPT.d_date AND RPT.d_date_end
                      LEFT JOIN dbo.fs_tariff AS FT
                                ON FT.link = RPT.f_tariff
                      LEFT JOIN LATERAL
                      (
                          SELECT
                              FTH.n_tariff,
                              FTH.n_tariff_2
                          FROM dbo.fs_tariff_history FTH
                          WHERE FTH.f_tariff = FT.link
                            AND FTH.b_default = TRUE
                            AND COALESCE(_D_Date, NOW()) BETWEEN FTH.d_date_begin AND FTH.d_date_end
                          ORDER BY
                              FTH.link
                          LIMIT 1
                      ) AS FTH
                      ON TRUE

                      LEFT JOIN dbo.ed_registr_pts_cap AS RCap
                                ON RCap.f_registr_pts = RP.link
                               AND RCap.b_contract = FALSE
                               AND COALESCE(_D_Date, NOW()) BETWEEN RCap.d_date AND RCap.d_date_end

                      LEFT JOIN LATERAL
                      (
                          SELECT
                              RCon_.n_cons,
                              RCon_.n_cons2,
                              RCon_.d_date
                          FROM dbo.ed_registr_pts_cons AS RCon_
                          WHERE RP.link = RCon_.f_registr_pts
                            AND RCon_.b_contract = FALSE
                            AND COALESCE(_D_Date, NOW()) BETWEEN RCon_.d_date AND RCon_.d_date_end
                          ORDER BY
                              RCon_.d_date
                          LIMIT 1
                      ) AS RCon
                      ON TRUE

                      LEFT JOIN dbo.ed_registr_pts_calc_methods AS RCM
                                ON RCM.f_registr_pts = RP.link
                               AND COALESCE(_D_Date, NOW()) BETWEEN RCM.d_date AND RCM.d_date_end
                      LEFT JOIN dbo.es_calc_methods AS ECM
                                ON ECM.link = RCM.f_calc_methods
                      LEFT JOIN dbo.es_calc_methods AS ECM2
                                ON ECM2.link = RCM.f_calc_methods_default

                      LEFT JOIN LATERAL
                      (
                          SELECT
                              EDP1.link,
                              EDP1.f_devices,
                              EDP1.f_energy_types,
                              EDP1.n_percent,
                              EDP1.n_percent2,
                              EDP1.b_main,
                              EDP1.f_division
                          FROM dbo.ed_devices_pts EDP1
                               INNER JOIN dbo.ed_devices D1
                                          ON D1.link = EDP1.f_devices
                                         AND D1.d_setup_date <= COALESCE(_D_Date, NOW())
                          WHERE EDP1.f_registr_pts = RP.link
                          ORDER BY
                              D1.d_setup_date DESC
                          LIMIT 1
                      ) AS EDP
                      ON TRUE

                      LEFT JOIN dbo.ed_devices D
                                ON D.link = EDP.f_devices
                      LEFT JOIN dbo.es_device_types EDT
                                ON EDT.link = D.f_device_types
                      LEFT JOIN dbo.es_device_categories EDC
                                ON EDC.link = EDT.f_device_categories
                      LEFT JOIN LATERAL dbo.ef_device_digits_list(D.link) AS Dig
                      ON TRUE

                      LEFT JOIN dbo.fs_sale_items AS FSI
                                ON FSI.link = RP.f_sale_items
                      LEFT JOIN dbo.fs_sale_categories AS FSC
                                ON FSC.link = RP.f_sale_category
                      LEFT JOIN dbo.es_energy_levels AS EEL
                                ON EEL.link = RP.f_energy_levels
                      LEFT JOIN dbo.es_balance_types AS EBT
                                ON EBT.link = RP.f_balance_types
                      LEFT JOIN dbo.es_loss_algorithms AS ELA
                                ON ELA.link = RP.f_transf_algorithms
                      LEFT JOIN dbo.es_loss_algorithms AS ELA2
                                ON ELA2.link = RP.f_line_algorithms
                      LEFT JOIN dbo.es_loss_algorithms AS ELA3
                                ON ELA3.link = RP.f_non_heat_algorithms

                      LEFT JOIN dbo.fs_norms FN
                                ON FN.link = RPT.f_norms
                      LEFT JOIN dbo.es_transf_types AS ETT
                                ON ETT.link = RP.f_transf_types
                      LEFT JOIN dbo.es_work_modes AS ESWM
                                ON ESWM.link = RCap.f_work_modes
                      LEFT JOIN dbo.es_energy_types AS EET
                                ON EET.link = EDP.f_energy_types

                 WHERE RP.d_date_begin <= COALESCE(_D_Date, NOW())
                   AND RP.f_division = COALESCE(_F_Division, RP.f_division)
                   AND (
                        _F_Areas = -1
                        OR _F_Areas = erpa.f_areas
                        OR (
                            _F_Areas IS NULL
                            AND erpa.f_areas IS NULL
                           )
                        OR (
                            _F_Areas IS NULL
                            AND erpa.f_areas = 0
                           )
                       );
END;
$$;
```

Initially, I thought the problem was in the tables used, because the structure has changed, but I checked the function with the replacement with the necessary ones, nothing has changed. So I think the problem is not in the tables.

Body:
I moved the function to Postgres. In MS SQL, it was executed in less than a second. In Postgresql, it runs for almost 6 minutes. I've been working on this problem for 6 hours, and I haven't found a reason. As I understand it, the problem is in the syntax.

In the xt_ed_registr_grp_led function, I attach the function (xt_ef_registr_pts_all) to a table in this format:

LEFT JOIN dbo.xt_ef_registr_pts_all(_D_Date, -1, NULL) AS RP_Child
                                    ON RP_Child.link = RG.f_registr_pts

Next, I attach the code from MS SQL and Postgres.

Postgres function

...
AS
$$
BEGIN

    RETURN QUERY SELECT
                     RP.link,
                     RP.f_division,
                     RP.f_subdivision,
                     RP.f_subscr,
                     RP.f_sale_items,
                     RP.f_sale_category,
                     RP.d_date_begin,
                     RP.d_date_end,
                     RCap.f_work_modes AS F_Work_Modes,
                     RP.f_energy_levels,
                     NP.f_conn_points,
                     NP.c_address_short,
                     CASE
                         WHEN COALESCE(Provinces.c_name, '') = ''
                             THEN NULL
                         ELSE LTRIM(RTRIM((COALESCE(LT_Provinces.c_prefix || ' ', '') || COALESCE(Provinces.c_name, ''))))
                     END AS C_Provinces,
                     CASE
                         WHEN COALESCE(Towns.c_name, '') = ''
                             THEN NULL
                         ELSE LTRIM(RTRIM((COALESCE(LT_Towns.c_prefix || ' ', '') || COALESCE(Towns.c_name, ''))))
                     END AS C_Towns,
                     CASE
                         WHEN COALESCE(Municipalities.c_name, '') = ''
                             THEN NULL
                         ELSE LTRIM(RTRIM((COALESCE(LT_Municipalities.c_prefix || ' ', '') || COALESCE(Municipalities.c_name, ''))))
                     END AS C_Municipalities,
                     CASE
                         WHEN LTRIM(RTRIM(((COALESCE(LT_Streets.c_prefix || ' ', '') || COALESCE(Streets.c_name, '')) || COALESCE(', ' || CP.c_building_num, '') ||
                                           COALESCE(COALESCE(' ' || sbct.c_short_name, ' ' || sbct.c_name, '/') || CP.c_building_corp, '')))) = ''
                             THEN NULL
                         ELSE LTRIM(RTRIM(((COALESCE(LT_Streets.c_prefix || ' ', '') || COALESCE(Streets.c_name, '')) || COALESCE(', ' || CP.c_building_num, '') ||
                                           COALESCE(COALESCE(' ' || sbct.c_short_name, ' ' || sbct.c_name, '/') || CP.c_building_corp, ''))))
                     END AS C_Street_Building,
                     RCM.f_calc_methods,
                     RCM.d_date AS D_Calc_Methods_Date,
                     CASE
                         WHEN EXISTS(SELECT
                                         0
                                     FROM dbo.ed_registr_grp RG1
                                     WHERE RG1.f_registr_pts_main = RP.link
                             )
                             THEN TRUE
                         ELSE FALSE
                     END AS B_Group,
                     CASE
                         WHEN EXISTS(SELECT
                                         0
                                     FROM dbo.ed_registr_grp RG1
                                     WHERE RG1.f_registr_pts = RP.link
                             )
                             THEN TRUE
                         ELSE FALSE
                     END AS B_IncludeGroup,
                     dbo.xt_ef_registr_pts_energy_categ(RP.f_sale_items, RP.f_tariff, RP.f_energy_levels) AS F_Energy_Category,
                     RP.f_registr_pts_prev,
                     D.link AS F_Device,
                     EDP.f_division AS f_device_division,
                     D.n_rate,
                     D.n_rate * dbo.ui_ef_device_transf_rate(D.f_division, D.link, COALESCE(_D_Date, NOW())) AS N_Ktf,
                     Dig.c_digits,
                     EDC.c_name AS C_Device_Category_Name,
                     EDC.f_class,
                     D.f_device_types,
                     D.c_serial_number,
                     EDP.f_energy_types,
                     EDP.n_percent2,
                     EDP.b_main AS B_Device_Main,
                     D.d_setup_date,
                     D.d_replace_date,
                     EDP.n_percent,
                     RPT.f_tariff,
                     RPT.d_date::timestamptz(0)::text AS D_Tariff_Date,
                     RPT.f_norms,
                     RCon.n_cons AS N_Cons_Cons,
                     RCon.n_cons2 AS N_Cons_Cons2,
                     RCon.d_date AS D_Cons_Date,
                     RCap.n_cap AS N_Cap_Cons,
                     RCap.n_cap2 AS N_Cap_Cons2,
                     RCap.n_cap3 AS N_Cap_Cons3,
                     RCap.d_date AS D_Cap_Date,
                     RPA.n_rate AS N_Activity_Rate,
                     RPA.d_date AS D_Activity_Date,
                     RP.c_code AS n_code,
                     RP.c_name,
                     RP.f_balance_types,
                     RP.f_balance_type_details,
                     RP.f_balance_types_sec,
                     RP.f_balance_type_details_sec,
                     RP.n_order,
                     RP.b_non_heat_formula,
                     RP.b_line_formula,
                     RP.b_transf_formula,
                     RP.f_transf_types,
                     SDA.link AS F_Areas,
                     erpa.d_date AS D_Areas_Date,
                     RP.b_notinclude,
                     RP.f_form_46,
                     RP.f_cons_category,
                     RP.s_owner,
                     RP.s_create_date,
                     RP.s_modif_date,
                     RP.s_creator,
                     NP.link AS F_Network_Pts,
                     NP.c_code AS C_Network_Pts_Code,
                     NR.c_network_path AS _Bound_F_Network_Pts,
                     NR.c_network_path_short AS C_Network_Path_Short,
                     CASE
                         WHEN NIP.f_parent IS NOT NULL
                             THEN dbo.cf_get_network_name(COALESCE(NI_P.f_networks, NI.f_networks))
                     END AS _Bound_F_Network,
                     FSI.c_name AS _Bound_F_Sale_Items,
                     EDT.c_name || COALESCE(' / ' || EDT.c_modification, '') AS _Bound_F_Device_Types,
                     (dbo.cf_get_c_codename(FT.n_code, FT.c_name) || ' / ' || CAST(COALESCE(FTH.n_tariff, '0') AS text) || 'р.') AS _Bound_F_Tariff,
                     FTH.n_tariff AS N_Tariff1,
                     FTH.n_tariff_2 AS N_Tariff2,
                     EEL.c_name AS _Bound_F_Energy_Levels,
                     ECM.c_name || COALESCE(' / ' || ECM2.c_name, '') AS _Bound_F_Calc_Methods,
                     COALESCE(EBT.c_short_name, EBT.c_name) AS _Bound_F_Balance_Types,
                     COALESCE(EET.c_short_name, EET.c_name) AS _Bound_F_Energy_Types,
                     ESWM.c_name AS _Bound_F_Work_Modes,
                     ELA.c_name AS _Bound_F_Transf_Algorithms,
                     ELA2.c_name AS _Bound_F_Line_Algorithms,
                     ELA3.c_name AS _Bound_F_Non_Heat_Algorithms,
                     SDA.c_name AS _Bound_F_Areas,
                     CP.c_code_cp AS N_Conn_Points_Code,
                     COALESCE(CP.c_name, NP.c_address_short) AS C_Conn_Points_Name,
                     COALESCE(CPS.c_name, '') || COALESCE(' ' || CT.c_name_short, '') || COALESCE(' № ' || CPS.c_premise_number, '') AS C_Conn_Points_Sub_Name,
                     CPS.c_premise_number AS C_Premise_Number,
                     COALESCE((CPS.j_custom ->> 'j_b_dryers')::bool, (CP.j_custom ->> 'j_b_dryers')::bool) AS B_Polotenchik,
                     COALESCE((CPS.j_custom ->> 'j_b_riser_insulation')::bool, (CP.j_custom ->> 'j_b_riser_insulation')::bool) AS B_Isolation,
                     COALESCE((CPS.j_custom ->> 'j_b_external_gvs')::bool, (CP.j_custom ->> 'j_b_external_gvs')::bool) AS B_OuterGVS,
                     CP.f_conn_types AS F_Conn_Types,
                     CP.f_conn_status_types AS F_Conn_Status_Types,
                     FSC.c_name AS _Bound_F_Sale_Category,
                     ETT.c_name AS _Bound_F_Transf_Types,
                     FN.c_name AS _Bound_F_Norms,
                     dbo.cf_get_network_name(COALESCE(NI_P.f_networks, NI.f_networks)) AS C_Network_Path,

                     RP.n_graph_form,
                     RP.n_line_loss,
                     RP.n_rp_loss,

                     NP.f_conn_points_sub,

                     RPL_Non_Heat.d_date_begin AS D_Non_Heat_Date,
                     RPL_Non_Heat.n_value AS N_Non_Heat_Waste,
                     RPL_Non_Heat.f_loss_algorithms AS F_Non_Heat_Algorithms,
                     RPL_Line.d_date_begin AS D_Line_Date,
                     RPL_Line.n_value AS N_Line_Waste,
                     RPL_Line.f_loss_algorithms AS F_Line_Algorithms,
                     RPL_Transf.d_date_begin AS D_Transf_Date,
                     RPL_Transf.n_value AS N_Transf_Waste,
                     RPL_Transf.f_loss_algorithms AS F_Transf_Algorithms,

                     s.n_code AS N_Code_Subscr,
                     p.c_name1 AS C_Name_Subscr

                 FROM dbo.ed_registr_pts AS RP

                      LEFT JOIN dbo.sd_subscr AS s
                                ON s.link = RP.f_subscr
                      LEFT JOIN dbo.cd_partners AS p
                                ON p.link = s.f_partners

                      LEFT JOIN dbo.ed_network_pts AS NP
                                ON NP.link = RP.f_network_pts
                               AND NP.b_pod = TRUE
                      LEFT JOIN LATERAL
                      (   SELECT
                              NIPX.link,
                              NIPX.f_parent
                          FROM dbo.ed_network_struct NIPX
                          WHERE NIPX.f_child = NP.link
                            AND NIPX.b_pod = TRUE
                            AND NIPX.b_ismain = TRUE
                            AND NIPX.d_date_begin <= COALESCE(_D_Date, NOW())
                          ORDER BY
                              NIPX.d_date_begin DESC
                          LIMIT 1
                      ) AS NIP
                      ON TRUE

                      LEFT JOIN LATERAL
                      (
                          SELECT
                              NIPX.link,
                              NIPX.f_parent
                          FROM dbo.ed_network_struct NIPX
                          WHERE NIPX.f_child = NP.f_network_pts
                            AND NIPX.b_pod = TRUE
                            AND NIPX.b_ismain = TRUE
                            AND NIPX.d_date_begin <= COALESCE(_D_Date, NOW())
                          ORDER BY
                              NIPX.d_date_begin DESC
                          LIMIT 1
                      ) AS NIP_P
                      ON TRUE

                      LEFT JOIN LATERAL
                      (
                         SELECT
                             NRi.id,
                             NRi.c_network_path,
                             NRi.c_network_path_short
                         FROM dbo.ed_network_routes NRi
                         WHERE NRi.n_level = 0
                           AND NRi.link = COALESCE(NIP_P.f_parent, NIP.f_parent)
                           AND NOW() >= NRi.d_date0
                           AND NOW() < NRi.d_date1
                         ORDER BY
                             NRi.n_rate,
                             NRi.d_date1,
                             NRi.b_main DESC
                         LIMIT 1
                      ) AS NR
                      ON TRUE

                      LEFT JOIN dbo.ed_network_pts NI
                                ON NI.link = NIP.f_parent
                               AND NI.b_pod = FALSE

                      LEFT JOIN dbo.ed_network_pts NI_P
                                ON NI_P.link = NIP_P.f_parent
                               AND NI_P.b_pod = FALSE

                     /* Объект и адрес */
                      LEFT JOIN dbo.sd_conn_points CP
                                ON CP.link = NP.f_conn_points
                      LEFT JOIN dbo.sd_conn_points_sub CPS
                                ON CPS.link = NP.f_conn_points_sub
                      LEFT JOIN dbo.cs_conn_types CT
                                ON CT.link = CPS.f_conn_types
                      LEFT JOIN dbo.ss_building_corp_type sbct
                                ON sbct.link = CP.f_building_corp_type
                      LEFT JOIN dbo.ss_locations AS Provinces
                                ON Provinces.link = CP.f_provinces_fias
                      LEFT JOIN dbo.ss_location_types AS LT_Provinces
                                ON LT_Provinces.link = Provinces.f_location_types
                      LEFT JOIN dbo.ss_locations AS Towns
                                ON Towns.link = CP.f_towns_fias
                      LEFT JOIN dbo.ss_location_types AS LT_Towns
                                ON LT_Towns.link = Towns.f_location_types
                      LEFT JOIN dbo.ss_locations AS Municipalities
                                ON Municipalities.link = CP.f_municipalities_fias
                      LEFT JOIN dbo.ss_location_types AS LT_Municipalities
                                ON LT_Municipalities.link = Municipalities.f_location_types
                      LEFT JOIN dbo.ss_locations AS Streets
                                ON Streets.link = CP.f_streets_fias
                      LEFT JOIN dbo.ss_location_types AS LT_Streets
                                ON LT_Streets.link = Streets.f_location_types /* Параметры ТУ */
                      LEFT JOIN dbo.ed_registr_pts_areas AS erpa
                                ON erpa.f_registr_pts = RP.link
                               AND erpa.d_date <= COALESCE(_D_Date, NOW())
                               AND erpa.d_date_end > COALESCE(_D_Date, NOW())

                      LEFT JOIN dbo.sd_areas AS SDA
                                ON SDA.link = erpa.f_areas

                      LEFT JOIN dbo.ed_registr_pts_loss AS RPL_Line
                                ON RPL_Line.f_registr_pts = RP.link
                               AND RPL_Line.f_loss_types = 1
                               AND COALESCE(_D_Date, NOW()) BETWEEN RPL_Line.d_date_begin AND RPL_Line.d_date_end
                      LEFT JOIN dbo.ed_registr_pts_loss AS RPL_Transf
                                ON RPL_Transf.f_registr_pts = RP.link
                               AND RPL_Transf.f_loss_types = 2
                               AND COALESCE(_D_Date, NOW()) BETWEEN RPL_Transf.d_date_begin AND RPL_Transf.d_date_end
                      LEFT JOIN dbo.ed_registr_pts_loss AS RPL_Non_Heat
                                ON RPL_Non_Heat.f_registr_pts = RP.link
                               AND RPL_Non_Heat.f_loss_types = 3
                               AND COALESCE(_D_Date, NOW()) BETWEEN RPL_Non_Heat.d_date_begin AND RPL_Non_Heat.d_date_end

                      LEFT JOIN LATERAL
                      (
                          SELECT
                              RPA1.n_rate,
                              RPA1.d_date,
                              RPA1.f_registr_pts
                          FROM dbo.ed_registr_pts_activity AS RPA1
                          WHERE RPA1.f_registr_pts = RP.link
                            AND RPA1.d_date <= COALESCE(_D_Date, NOW())
                          ORDER BY
                              d_date DESC
                          LIMIT 1
                      ) AS RPA
                      ON TRUE

                      LEFT JOIN dbo.ed_registr_pts_tariff AS RPT
                                ON RPT.f_registr_pts = RP.link
                               AND COALESCE(_D_Date, NOW()) BETWEEN RPT.d_date AND RPT.d_date_end
                      LEFT JOIN dbo.fs_tariff AS FT
                                ON FT.link = RPT.f_tariff
                      LEFT JOIN LATERAL
                      (
                          SELECT
                              FTH.n_tariff,
                              FTH.n_tariff_2
                          FROM dbo.fs_tariff_history FTH
                          WHERE FTH.f_tariff = FT.link
                            AND FTH.b_default = TRUE
                            AND COALESCE(_D_Date, NOW()) BETWEEN FTH.d_date_begin AND FTH.d_date_end
                          ORDER BY
                              FTH.link
                          LIMIT 1
                      ) AS FTH
                      ON TRUE

                      LEFT JOIN dbo.ed_registr_pts_cap AS RCap
                                ON RCap.f_registr_pts = RP.link
                               AND RCap.b_contract = FALSE
                               AND COALESCE(_D_Date, NOW()) BETWEEN RCap.d_date AND RCap.d_date_end

                      LEFT JOIN LATERAL
                      (
                          SELECT
                              RCon_.n_cons,
                              RCon_.n_cons2,
                              RCon_.d_date
                          FROM dbo.ed_registr_pts_cons AS RCon_
                          WHERE RP.link = RCon_.f_registr_pts
                            AND RCon_.b_contract = FALSE
                            AND COALESCE(_D_Date, NOW()) BETWEEN RCon_.d_date AND RCon_.d_date_end
                          ORDER BY
                              RCon_.d_date
                          LIMIT 1
                      ) AS RCon
                      ON TRUE

                      LEFT JOIN dbo.ed_registr_pts_calc_methods AS RCM
                                ON RCM.f_registr_pts = RP.link
                               AND COALESCE(_D_Date, NOW()) BETWEEN RCM.d_date AND RCM.d_date_end
                      LEFT JOIN dbo.es_calc_methods AS ECM
                                ON ECM.link = RCM.f_calc_methods
                      LEFT JOIN dbo.es_calc_methods AS ECM2
                                ON ECM2.link = RCM.f_calc_methods_default

                      LEFT JOIN LATERAL
                      (
                          SELECT
                              EDP1.link,
                              EDP1.f_devices,
                              EDP1.f_energy_types,
                              EDP1.n_percent,
                              EDP1.n_percent2,
                              EDP1.b_main,
                              EDP1.f_division
                          FROM dbo.ed_devices_pts EDP1
                               INNER JOIN dbo.ed_devices D1
                                          ON D1.link = EDP1.f_devices
                                         AND D1.d_setup_date <= COALESCE(_D_Date, NOW())
                          WHERE EDP1.f_registr_pts = RP.link
                          ORDER BY
                              D1.d_setup_date DESC
                          LIMIT 1
                      ) AS EDP
                      ON TRUE

                      LEFT JOIN dbo.ed_devices D
                                ON D.link = EDP.f_devices
                      LEFT JOIN dbo.es_device_types EDT
                                ON EDT.link = D.f_device_types
                      LEFT JOIN dbo.es_device_categories EDC
                                ON EDC.link = EDT.f_device_categories
                      LEFT JOIN LATERAL dbo.ef_device_digits_list(D.link) AS Dig
                      ON TRUE

                      LEFT JOIN dbo.fs_sale_items AS FSI
                                ON FSI.link = RP.f_sale_items
                      LEFT JOIN dbo.fs_sale_categories AS FSC
                                ON FSC.link = RP.f_sale_category
                      LEFT JOIN dbo.es_energy_levels AS EEL
                                ON EEL.link = RP.f_energy_levels
                      LEFT JOIN dbo.es_balance_types AS EBT
                                ON EBT.link = RP.f_balance_types
                      LEFT JOIN dbo.es_loss_algorithms AS ELA
                                ON ELA.link = RP.f_transf_algorithms
                      LEFT JOIN dbo.es_loss_algorithms AS ELA2
                                ON ELA2.link = RP.f_line_algorithms
                      LEFT JOIN dbo.es_loss_algorithms AS ELA3
                                ON ELA3.link = RP.f_non_heat_algorithms

                      LEFT JOIN dbo.fs_norms FN
                                ON FN.link = RPT.f_norms
                      LEFT JOIN dbo.es_transf_types AS ETT
                                ON ETT.link = RP.f_transf_types
                      LEFT JOIN dbo.es_work_modes AS ESWM
                                ON ESWM.link = RCap.f_work_modes
                      LEFT JOIN dbo.es_energy_types AS EET
                                ON EET.link = EDP.f_energy_types

                 WHERE RP.d_date_begin <= COALESCE(_D_Date, NOW())
                   AND RP.f_division = COALESCE(_F_Division, RP.f_division)
                   AND (
                        _F_Areas = -1
                        OR _F_Areas = erpa.f_areas
                        OR (
                            _F_Areas IS NULL
                            AND erpa.f_areas IS NULL
                           )
                        OR (
                            _F_Areas IS NULL
                            AND erpa.f_areas = 0
                           )
                       );
END;
$$;

Initially, I thought the problem was in the tables used, because the structure has changed, but I checked the function with the replacement with the necessary ones, nothing has changed. So I think the problem is not in the tables.


问:
EntityFramework query
```<code>CREATE TABLE IF NOT EXISTS users (
    UserId int auto_increment,
    RegisterId int,
    PRIMARY KEY(UserId)
);

CREATE TABLE IF NOT EXISTS products (
    ProductId int auto_increment,
    ProductName varchar(10),
    UserId int,
    PRIMARY KEY(ProductId)
);
ALTER TABLE products
ADD CONSTRAINT FK_products_users_UserId
FOREIGN KEY (UserId) REFERENCES users(UserId) ON DELETE CASCADE;

INSERT INTO users values( 1, 3);
INSERT INTO products values (1, "Television", 1) ;
INSERT INTO products values (2, "IPhone", 1) ;
INSERT INTO products values (3, "Television", 1) ;
</code>```

using (var db = new someEntities())
{
   var dbReturn = db.users.Join(db.products,
                    x => x.UserId,
                    y => y.UserId,
                    (x, y) => new
                    {
                        x.RegisterId,
                        x.UserId,
                        y.ProductId,
                        y.ProductName
                    })
                    .Where(w => w.UserId == 1)
                    .GroupBy(g => g.RegisterId)
                    .Where(w => w.OrderByDescending(o => o.ProductId)
                          .FirstOrDefault()
                          .ProductName == "Television")
                    .Select(t => new
                    {
                        ProductId = t.Select(s => s.ProductId)
                                        .FirstOrDefault(),
                        ProductName = t.Select(s => s.ProductName)
                                        .FirstOrDefault(),
                        Key = t.Key,
                    })
                    .ToList();
   Console.WriteLine(dbReturn.FirstOrDefault().ProductId);
}
```
<p>Unexpectedly, i get an error saying</p>
<blockquote>
<p>MySqlException: Unknown column 'Join1.RegisterId' in 'where clause'".</p>
</blockquote>
<p>When i query (generated sql) in mysql than i get same error as expected.</p>
<p>There is no <code>AS JOIN1</code> in sql query.</p>
<p>So, what is wrong with my linq query?</p>
<pre class="lang-sql prettyprint-override"><code>SELECT
1 AS `C1`,
CASE WHEN (`Project8`.`C1` IS NOT NULL) THEN (`Project8`.`C2`)  ELSE (0) END AS `C2`,
`Project8`.`C3`,
`Project8`.`RegisterId`
 FROM (SELECT
`Project6`.`RegisterId`,
`Project6`.`C1`,
`Project6`.`C2`,
(SELECT
`Extent10`.`ProductName`
 FROM `users` AS `Extent9` INNER JOIN `products` AS `Extent10` ON `Extent9`.`UserId` = `Extent10`.`UserId`
 WHERE (1 = `Extent9`.`UserId`) AND ((`Project6`.`RegisterId` = `Extent9`.`RegisterId`) OR ((`Project6`.`RegisterId` IS  NULL) AND (`Extent9`.`RegisterId` IS  NULL))) LIMIT 1) AS `C3`
 FROM (SELECT
`Project4`.`RegisterId`,
`Project4`.`C1`,
(SELECT
`Extent8`.`ProductId`
 FROM `users` AS `Extent7` INNER JOIN `products` AS `Extent8` ON `Extent7`.`UserId` = `Extent8`.`UserId`
 WHERE (1 = `Extent7`.`UserId`) AND ((`Project4`.`RegisterId` = `Extent7`.`RegisterId`) OR ((`Project4`.`RegisterId` IS  NULL) AND (`Extent7`.`RegisterId` IS  NULL))) LIMIT 1) AS `C2`
 FROM (SELECT
`Apply1`.`RegisterId`,
(SELECT
`Extent6`.`ProductId`
 FROM `users` AS `Extent5` INNER JOIN `products` AS `Extent6` ON `Extent5`.`UserId` = `Extent6`.`UserId`
 WHERE (1 = `Extent5`.`UserId`) AND ((`Apply1`.`RegisterId` = `Extent5`.`RegisterId`) OR ((`Apply1`.`RegisterId` IS  NULL) AND (`Extent5`.`RegisterId` IS  NULL))) LIMIT 1) AS `C1`
 FROM (SELECT
`Distinct1`.`RegisterId`,
(SELECT
`Project2`.`ProductId`
 FROM (SELECT
`Extent4`.`ProductId`,
`Extent4`.`ProductName`
 FROM `users` AS `Extent3` INNER JOIN `products` AS `Extent4` ON `Extent3`.`UserId` = `Extent4`.`UserId`
 WHERE (1 = `Extent3`.`UserId`) AND ((`Join1`.`RegisterId` = `Extent3`.`RegisterId`) OR ((`Join1`.`RegisterId` IS  NULL) AND (`Extent3`.`RegisterId` IS  NULL)))) AS `Project2`
 ORDER BY
`Project2`.`ProductId` DESC LIMIT 1) AS `ProductId`,
(SELECT
`Project2`.`ProductName`
 FROM (SELECT
`Extent4`.`ProductId`,
`Extent4`.`ProductName`
 FROM `users` AS `Extent3` INNER JOIN `products` AS `Extent4` ON `Extent3`.`UserId` = `Extent4`.`UserId`
 WHERE (1 = `Extent3`.`UserId`) AND ((`Join1`.`RegisterId` = `Extent3`.`RegisterId`) OR ((`Join1`.`RegisterId` IS  NULL) AND (`Extent3`.`RegisterId` IS  NULL)))) AS `Project2`
 ORDER BY
`Project2`.`ProductId` DESC LIMIT 1) AS `ProductName`
 FROM (SELECT  DISTINCT
`Extent1`.`RegisterId`
 FROM `users` AS `Extent1` INNER JOIN `products` AS `Extent2` ON `Extent1`.`UserId` = `Extent2`.`UserId`
 WHERE 1 = `Extent1`.`UserId`) AS `Distinct1`) AS `Apply1`
 WHERE @gp1 = `Apply1`.`ProductName`) AS `Project4`) AS `Project6`) AS `Project8`
</code>```

Title: EntityFramework query

Body:
CREATE TABLE IF NOT EXISTS users (
    UserId int auto_increment,
    RegisterId int,
    PRIMARY KEY(UserId)
);

CREATE TABLE IF NOT EXISTS products (
    ProductId int auto_increment,
    ProductName varchar(10),
    UserId int,
    PRIMARY KEY(ProductId)
);
ALTER TABLE products
ADD CONSTRAINT FK_products_users_UserId
FOREIGN KEY (UserId) REFERENCES users(UserId) ON DELETE CASCADE;

INSERT INTO users values( 1, 3);
INSERT INTO products values (1, "Television", 1) ;
INSERT INTO products values (2, "IPhone", 1) ;
INSERT INTO products values (3, "Television", 1) ;

using (var db = new someEntities())
{
   var dbReturn = db.users.Join(db.products,
                    x => x.UserId,
                    y => y.UserId,
                    (x, y) => new
                    {
                        x.RegisterId,
                        x.UserId,
                        y.ProductId,
                        y.ProductName
                    })
                    .Where(w => w.UserId == 1)
                    .GroupBy(g => g.RegisterId)
                    .Where(w => w.OrderByDescending(o => o.ProductId)
                          .FirstOrDefault()
                          .ProductName == "Television")
                    .Select(t => new
                    {
                        ProductId = t.Select(s => s.ProductId)
                                        .FirstOrDefault(),
                        ProductName = t.Select(s => s.ProductName)
                                        .FirstOrDefault(),
                        Key = t.Key,
                    })
                    .ToList();
   Console.WriteLine(dbReturn.FirstOrDefault().ProductId);
}

Unexpectedly, i get an error saying

MySqlException: Unknown column 'Join1.RegisterId' in 'where clause'".

When i query (generated sql) in mysql than i get same error as expected.

There is no AS JOIN1 in sql query.

So, what is wrong with my linq query?

SELECT
1 AS `C1`,
CASE WHEN (`Project8`.`C1` IS NOT NULL) THEN (`Project8`.`C2`)  ELSE (0) END AS `C2`,
`Project8`.`C3`,
`Project8`.`RegisterId`
 FROM (SELECT
`Project6`.`RegisterId`,
`Project6`.`C1`,
`Project6`.`C2`,
(SELECT
`Extent10`.`ProductName`
 FROM `users` AS `Extent9` INNER JOIN `products` AS `Extent10` ON `Extent9`.`UserId` = `Extent10`.`UserId`
 WHERE (1 = `Extent9`.`UserId`) AND ((`Project6`.`RegisterId` = `Extent9`.`RegisterId`) OR ((`Project6`.`RegisterId` IS  NULL) AND (`Extent9`.`RegisterId` IS  NULL))) LIMIT 1) AS `C3`
 FROM (SELECT
`Project4`.`RegisterId`,
`Project4`.`C1`,
(SELECT
`Extent8`.`ProductId`
 FROM `users` AS `Extent7` INNER JOIN `products` AS `Extent8` ON `Extent7`.`UserId` = `Extent8`.`UserId`
 WHERE (1 = `Extent7`.`UserId`) AND ((`Project4`.`RegisterId` = `Extent7`.`RegisterId`) OR ((`Project4`.`RegisterId` IS  NULL) AND (`Extent7`.`RegisterId` IS  NULL))) LIMIT 1) AS `C2`
 FROM (SELECT
`Apply1`.`RegisterId`,
(SELECT
`Extent6`.`ProductId`
 FROM `users` AS `Extent5` INNER JOIN `products` AS `Extent6` ON `Extent5`.`UserId` = `Extent6`.`UserId`
 WHERE (1 = `Extent5`.`UserId`) AND ((`Apply1`.`RegisterId` = `Extent5`.`RegisterId`) OR ((`Apply1`.`RegisterId` IS  NULL) AND (`Extent5`.`RegisterId` IS  NULL))) LIMIT 1) AS `C1`
 FROM (SELECT
`Distinct1`.`RegisterId`,
(SELECT
`Project2`.`ProductId`
 FROM (SELECT
`Extent4`.`ProductId`,
`Extent4`.`ProductName`
 FROM `users` AS `Extent3` INNER JOIN `products` AS `Extent4` ON `Extent3`.`UserId` = `Extent4`.`UserId`
 WHERE (1 = `Extent3`.`UserId`) AND ((`Join1`.`RegisterId` = `Extent3`.`RegisterId`) OR ((`Join1`.`RegisterId` IS  NULL) AND (`Extent3`.`RegisterId` IS  NULL)))) AS `Project2`
 ORDER BY
`Project2`.`ProductId` DESC LIMIT 1) AS `ProductId`,
(SELECT
`Project2`.`ProductName`
 FROM (SELECT
`Extent4`.`ProductId`,
`Extent4`.`ProductName`
 FROM `users` AS `Extent3` INNER JOIN `products` AS `Extent4` ON `Extent3`.`UserId` = `Extent4`.`UserId`
 WHERE (1 = `Extent3`.`UserId`) AND ((`Join1`.`RegisterId` = `Extent3`.`RegisterId`) OR ((`Join1`.`RegisterId` IS  NULL) AND (`Extent3`.`RegisterId` IS  NULL)))) AS `Project2`
 ORDER BY
`Project2`.`ProductId` DESC LIMIT 1) AS `ProductName`
 FROM (SELECT  DISTINCT
`Extent1`.`RegisterId`
 FROM `users` AS `Extent1` INNER JOIN `products` AS `Extent2` ON `Extent1`.`UserId` = `Extent2`.`UserId`
 WHERE 1 = `Extent1`.`UserId`) AS `Distinct1`) AS `Apply1`
 WHERE @gp1 = `Apply1`.`ProductName`) AS `Project4`) AS `Project6`) AS `Project8`


问:
Kotlin & DynamoDB: Unable to resolve host "dynamodb.us-east-1.amazonaws.com": No address associated with hostname
I'm trying to connect my Kotlin Android app to DynamoDB in AWS using Android Studio. My credential details are replaced in the code below and it is connecting to an AWS sandbox. The created database client is below:

```<code>val staticCredentials = StaticCredentialsProvider {
    accessKeyId = MY_ACCESS_KEY_HERE
    secretAccessKey = MY_SECRET_ACCESS_KEY
}

ddb = DynamoDbClient{
    region = MY_REGION_HERE
    credentialsProvider = staticCredentials
}
</code>```

Then I attempted to create the table using this client following these steps :

```<code>val tableNameVal = "Users"

val attDef = AttributeDefinition {
    attributeName = key
    attributeType = ScalarAttributeType.S
}

val keySchemaVal = KeySchemaElement {
    attributeName = key
    keyType = KeyType.Hash
}

val provisionedVal = ProvisionedThroughput {
    readCapacityUnits = 10
    writeCapacityUnits = 10
}

val request = CreateTableRequest {
    attributeDefinitions = listOf(attDef)
    keySchema = listOf(keySchemaVal)
    provisionedThroughput = provisionedVal
    tableName = tableNameVal
}

var tableArn: String
val response = ddb.createTable(request)
ddb.waitUntilTableExists { // suspend call
    tableName = tableNameVal
}
tableArn = response.tableDescription!!.tableArn.toString()
println("Table $tableArn is ready")
</code>```

However when I do this, I get an error when the createTable method is called:
java.net.UnknownHostException: Unable to resolve host "dynamodb.us-east-1.amazonaws.com": No address associated with hostname

I've tried doing a scan instead but I also get the same error. I thought that with AWS, if you provide the correct credentials and region, it wouldn't need any extra endpoints yet I'm still getting this "no hostname" error. I've looked at other code in JS with similar issues but couldn't get it working. Any help would be appreciated.

Body:
I'm trying to connect my Kotlin Android app to DynamoDB in AWS using Android Studio. My credential details are replaced in the code below and it is connecting to an AWS sandbox. The created database client is below:

val staticCredentials = StaticCredentialsProvider {
    accessKeyId = MY_ACCESS_KEY_HERE
    secretAccessKey = MY_SECRET_ACCESS_KEY
}

ddb = DynamoDbClient{
    region = MY_REGION_HERE
    credentialsProvider = staticCredentials
}

Then I attempted to create the table using this client following these steps :

val tableNameVal = "Users"

val attDef = AttributeDefinition {
    attributeName = key
    attributeType = ScalarAttributeType.S
}

val keySchemaVal = KeySchemaElement {
    attributeName = key
    keyType = KeyType.Hash
}

val provisionedVal = ProvisionedThroughput {
    readCapacityUnits = 10
    writeCapacityUnits = 10
}

val request = CreateTableRequest {
    attributeDefinitions = listOf(attDef)
    keySchema = listOf(keySchemaVal)
    provisionedThroughput = provisionedVal
    tableName = tableNameVal
}

var tableArn: String
val response = ddb.createTable(request)
ddb.waitUntilTableExists { // suspend call
    tableName = tableNameVal
}
tableArn = response.tableDescription!!.tableArn.toString()
println("Table $tableArn is ready")

However when I do this, I get an error when the createTable method is called:
java.net.UnknownHostException: Unable to resolve host "dynamodb.us-east-1.amazonaws.com": No address associated with hostname

I've tried doing a scan instead but I also get the same error. I thought that with AWS, if you provide the correct credentials and region, it wouldn't need any extra endpoints yet I'm still getting this "no hostname" error. I've looked at other code in JS with similar issues but couldn't get it working. Any help would be appreciated.


问:
DiscordAPIError[50035]: Invalid Form Body
I have this Code:

    const ticketModal = new ModalBuilder()
        .setTitle('test')
        .setCustomId('test')
        .addComponents({
            "type": 1,
            "components": [{
                "type": 4,
                "custom_id": 'test',
                "style": TextInputStyle.Short,
                "label": 'test',
                "min_length": 1,
                "max_length": 4000,
                "placeholder": 'test'
            }]
        })
```

However, it always comes this:

components[1][TAG_FIELD_MISSING]: Field "type" is required to determine the model type.

Body:
I have this Code:

    const ticketModal = new ModalBuilder()
        .setTitle('test')
        .setCustomId('test')
        .addComponents({
            "type": 1,
            "components": [{
                "type": 4,
                "custom_id": 'test',
                "style": TextInputStyle.Short,
                "label": 'test',
                "min_length": 1,
                "max_length": 4000,
                "placeholder": 'test'
            }]
        })

However, it always comes this:

components[1][TAG_FIELD_MISSING]: Field "type" is required to determine the model type.


问:
Slack app interactive message callback, username from payload not display name
We have created a Slack app that can respond to interactive messages (with blocks), i.e. a message with a clickable button. The app is configured correctly so when a user clicks the button a payload is sent to the request callback URL defined for our app.

The Slack JSON payload we receive contains a user object of the interacting user. However, the username field looks like an ID and is not the human readable display name.

Here is a redacted example of the payload sent by Slack to our request URL.

```<code>{
    "type": "block_actions",
    "user": {
        "id": "U04xxxxxx",
        "username": "00u6xxxxxxxx",
        "name": "00u6xxxxxxxx",
        "team_id": "T3xxxxx"
    },
    "api_app_id": "A021XXXXXX",
    "token": "xxx",
    "channel": {...},
    "message": {...}
}
</code>```

Both, the username and name fields are set to the same coded value and not the display name. Is there a setting in the Slack app for this? I don't have access to administer the Slack app settings.

Body:
We have created a Slack app that can respond to interactive messages (with blocks), i.e. a message with a clickable button. The app is configured correctly so when a user clicks the button a payload is sent to the request callback URL defined for our app.

The Slack JSON payload we receive contains a user object of the interacting user. However, the username field looks like an ID and is not the human readable display name.

Here is a redacted example of the payload sent by Slack to our request URL.

{
    "type": "block_actions",
    "user": {
        "id": "U04xxxxxx",
        "username": "00u6xxxxxxxx",
        "name": "00u6xxxxxxxx",
        "team_id": "T3xxxxx"
    },
    "api_app_id": "A021XXXXXX",
    "token": "xxx",
    "channel": {...},
    "message": {...}
}

Both, the username and name fields are set to the same coded value and not the display name. Is there a setting in the Slack app for this? I don't have access to administer the Slack app settings.


问:
How to get value from input with value that has been set as part of ngOnInit()? - Angular Reactive Forms
I have set a form's input field value in my component.ts file, however when I try to post the data using an API, the FormData is returning undefined rather than the value. I have checked this when not using setValue() for the input field, and the data is sent okay.

Component.ts:

```<code>this.commentForm.controls['createdBy'].setValue(sessionStorage['name']);
this.commentForm.controls['createdBy'].disable();
</code>```

onSubmit() function:

```<code>onSubmit() {
        this.webService.postClubComment(this.commentForm.value).subscribe((response: any) => {
                                                                this.commentForm.reset();
                                                                window.location.reload();
        });
    }
</code>```

postClubComment():

```<code>postClubComment(comment: any) {
        let postData = new FormData();
        postData.append("createdBy", comment.createdBy);
        postData.append("comment", comment.comment);

        let today = new Date();
        let todayDate = today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
        postData.append("date", todayDate)

        return this.http.post(this.URL + this.clubId + "/comments", postData);
    }
</code>```

Data is being posted successfully, however the createdBy field is being posted as undefined

Any help would be appreciated! :)

Body:
I have set a form's input field value in my component.ts file, however when I try to post the data using an API, the FormData is returning undefined rather than the value. I have checked this when not using setValue() for the input field, and the data is sent okay.

Component.ts:

this.commentForm.controls['createdBy'].setValue(sessionStorage['name']);
this.commentForm.controls['createdBy'].disable();

onSubmit() function:

onSubmit() {
        this.webService.postClubComment(this.commentForm.value).subscribe((response: any) => {
                                                                this.commentForm.reset();
                                                                window.location.reload();
        });
    }

postClubComment():

postClubComment(comment: any) {
        let postData = new FormData();
        postData.append("createdBy", comment.createdBy);
        postData.append("comment", comment.comment);

        let today = new Date();
        let todayDate = today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
        postData.append("date", todayDate)

        return this.http.post(this.URL + this.clubId + "/comments", postData);
    }

Data is being posted successfully, however the createdBy field is being posted as undefined

Any help would be appreciated! :)


问:
Mysql UPDATE does not work with INNER JOIN on server
I have an query:

```<code>UPDATE production.review_comments as t2
INNER JOIN (
    SELECT review_id as id FROM production.company_reviews
    WHERE company_reviews.company_id = 1
) as t1 on t1.id = t2.id
SET t2.body = REPLACE(t2.body, 'qwerty', 'ytrewq')
WHERE t2.id != 0;
</code>```

0 changes and 0 found

but query:

```<code>SELECT review_id as id FROM production.company_reviews
    WHERE company_reviews.company_id = 1
</code>```

has a result: 1, 2, 3 and review_comments has this ids on production.
On local this query works, but on production 0 founds or changes. Maybe there is some mysql settings on server?

I want to know what could be the reason

Body:
I have an query:

UPDATE production.review_comments as t2
INNER JOIN (
    SELECT review_id as id FROM production.company_reviews
    WHERE company_reviews.company_id = 1
) as t1 on t1.id = t2.id
SET t2.body = REPLACE(t2.body, 'qwerty', 'ytrewq')
WHERE t2.id != 0;

0 changes and 0 found

but query:

SELECT review_id as id FROM production.company_reviews
    WHERE company_reviews.company_id = 1

has a result: 1, 2, 3 and review_comments has this ids on production.
On local this query works, but on production 0 founds or changes. Maybe there is some mysql settings on server?

I want to know what could be the reason


问:
Amazon SQS returns random quantity of messages
I have connected Amazon SP-API with Amazon SQS, to get notifications about new orders. I got needed notifications to the SQS, but for some reason when I try to receive those notifications from my App, all time I got:

Random quantity of messages in the response. If I make 3 requests, the first can return 2 messages, the second 1 message, and the third 5 messages.

All time it's less than the value of MaxNumberOfMessages (I set 10), but I have more than 30 messages in the SQS.

Here is my code that I use to get notifications to my App:

```<code>        $queueUrl = "https://sqs.us-east-1.amazonaws.com/xxxxxxxxxxxx/XXXXXXX";
        $credentials = new Credentials(env('AWS_ACCESS_KEY_ID'), env('AWS_SECRET_ACCESS_KEY'));

        $client = new SqsClient([
            'region' => 'us-east-1',
            'version' => 'latest',
            'credentials' => $credentials,
        ]);

        try {
            $result = $client->receiveMessage(array(
                'AttributeNames' => ['SentTimestamp'],
                'MaxNumberOfMessages' => 10,
                'MessageAttributeNames' => ['All'],
                'QueueUrl' => $queueUrl, // REQUIRED
                'WaitTimeSeconds' => 20
            ));
            $messages = $result->get('Messages');
</code>```

How can I get at least 10 messages in 1 request? Why it's so randomly?

Body:
I have connected Amazon SP-API with Amazon SQS, to get notifications about new orders. I got needed notifications to the SQS, but for some reason when I try to receive those notifications from my App, all time I got:

Random quantity of messages in the response. If I make 3 requests, the first can return 2 messages, the second 1 message, and the third 5 messages.

All time it's less than the value of MaxNumberOfMessages (I set 10), but I have more than 30 messages in the SQS.

Here is my code that I use to get notifications to my App:

        $queueUrl = "https://sqs.us-east-1.amazonaws.com/xxxxxxxxxxxx/XXXXXXX";
        $credentials = new Credentials(env('AWS_ACCESS_KEY_ID'), env('AWS_SECRET_ACCESS_KEY'));

        $client = new SqsClient([
            'region' => 'us-east-1',
            'version' => 'latest',
            'credentials' => $credentials,
        ]);

        try {
            $result = $client->receiveMessage(array(
                'AttributeNames' => ['SentTimestamp'],
                'MaxNumberOfMessages' => 10,
                'MessageAttributeNames' => ['All'],
                'QueueUrl' => $queueUrl, // REQUIRED
                'WaitTimeSeconds' => 20
            ));
            $messages = $result->get('Messages');

How can I get at least 10 messages in 1 request? Why it's so randomly?


问:
Assembly on Windows
i'm was studying about cpu architetures for study the assembly language, but i have this doubt because many tutorials on yt i see peoples using a based Linux distribution to create, compile,and run assembly code.

can you help me? thanks!

I'm was trying to compile the .asm using the NASM, bt when i run it, it "sleep" for seconds and stop the execution, i'm was seeing and try testing with Mingw, but has the same problem.

i'm was searching in very sites and videos but i can't find it

i'm try using: nasm -f win32 App.asm  and gcc App.obj -o App.exe to compile it to an exe

and .\App.exe to run

Title: Assembly on Windows


问:
Can't subset columns past the end
We extracted a column from our dataframe(called "DT") that we had to test for reliability by using the Cronbach alpha.

The code we used to extract the data was:

Mydata_age <- DT %>% select(as.numeric(as.character(DT$Q7...23)))

We did this because at first "DT$Q7...23" did not give us a numeric value, even though it contained ages of participants in a survey we made and used to extract our data from.

However, when we ran the code it keeps saying

Can't subset columns past the end

There are only 24 columns

We expected Mydata_age to work and then to run Alpha(Mydata_age) to give us a value.

Title: Can't subset columns past the end


问:
macOS swift get first time App install date
How to get date of mac app purchased from App Store? (not related to In App Purchase just the date of  first time app downloaded)

I have tried below code but the date will be changed when user deleted the app folder from Library.

```<code>let urlToDocumentsFolder = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).last!
    //installDate is NSDate of install
    let installDate = (try! NSFileManager.defaultManager().attributesOfItemAtPath(urlToDocumentsFolder.path!)[NSFileCreationDate])
    print("This app was installed by the user on \(installDate)")
</code>```

Body:
How to get date of mac app purchased from App Store? (not related to In App Purchase just the date of  first time app downloaded)

I have tried below code but the date will be changed when user deleted the app folder from Library.

let urlToDocumentsFolder = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).last!
    //installDate is NSDate of install
    let installDate = (try! NSFileManager.defaultManager().attributesOfItemAtPath(urlToDocumentsFolder.path!)[NSFileCreationDate])
    print("This app was installed by the user on \(installDate)")


问:
I am trying to integrate a library known as @react-native-voice/voice to my react native mac application, but i am getting some error
enter image description hereI am getting error which mentions, Module App Registry is not a registered callable module

I tried different solutions such as trying out different libraries, reinstalling the node modules, tried different commands such as npx start --reset-cache, but the error still persists


问:
Percentage of grand total per small sample not in general
I have the finanacials dataset that comes by default in power bi. The case is that I want to make a field parameter that contains the variables country, product, segment and month name, which I alrady succsessfully did. Followed by a graph that making use of small samples allows me to see the count of invoices that have been made per day and in percentage.

The case is that if I put that it shows me the value as a percentage of grand total it does it taking into account the total and I don't want that. That is to say, I want the percentage to be centered in the sample itself.

Any idea how to achieve this?

(https://i.stack.imgur.com/8k4WR.png)

(https://i.stack.imgur.com/3Wj9f.png)

I've tried to follow some posts from powerbi community but there's not enough info about this issue.


问:
Full text search in Spring boot with PostgreSQL Database using Hibernate Search is not working as expected
I'm trying to build a full text search application with Spring Boot using PostgreSQL Database.

Reference: https://dev.to/fabiothiroki/setup-spring-and-postgres-for-full-text-search-4n97

It's a good article to start. But, this application works for 1 entity only at a time.

Problem I'm facing is:

Cannot register multiple functions. Due to this not able to work with other entities. Latest function only will be registered. Ex: pfts won't work as it is not the latest registered function, cfts will work.

Tried to pass search parameters/fields dynamically. But not working. Looks like columns/fields need to passed during function registration only. Ex: Below pfts works,cfts doesn't work. Enabled Hibernate parameter bindings and saw the columns/fields are passed correctly. Still, doesn't work.

Sample Code below with above 2 scenarios:

```<code>public class FullTextSearchContributor implements MetadataBuilderContributor {
    @Override
    public void contribute(MetadataBuilder metadataBuilder) {
        metadataBuilder.applySqlFunction("pfts", new SQLFunctionTemplate(BooleanType.INSTANCE, "to_tsvector(name || description) @@ to_tsquery(?1)"));
        metadataBuilder.applySqlFunction("cfts", new SQLFunctionTemplate(BooleanType.INSTANCE, "to_tsvector(?1) @@ to_tsquery(?2)"));
    }

}
</code>```

Basically I need to do full text search on multiple tables/entities with multiple columns (i.e., columns/fields to be passed dynamically to to_tsvector() as the columns/fields will be varying according to the tables/entities)

Note: No Table Joining concept.

Help would be appreciated.

Body:
I'm trying to build a full text search application with Spring Boot using PostgreSQL Database.

Reference: https://dev.to/fabiothiroki/setup-spring-and-postgres-for-full-text-search-4n97

It's a good article to start. But, this application works for 1 entity only at a time.

Problem I'm facing is:

Cannot register multiple functions. Due to this not able to work with other entities. Latest function only will be registered. Ex: pfts won't work as it is not the latest registered function, cfts will work.

Tried to pass search parameters/fields dynamically. But not working. Looks like columns/fields need to passed during function registration only. Ex: Below pfts works,cfts doesn't work. Enabled Hibernate parameter bindings and saw the columns/fields are passed correctly. Still, doesn't work.

Sample Code below with above 2 scenarios:

public class FullTextSearchContributor implements MetadataBuilderContributor {
    @Override
    public void contribute(MetadataBuilder metadataBuilder) {
        metadataBuilder.applySqlFunction("pfts", new SQLFunctionTemplate(BooleanType.INSTANCE, "to_tsvector(name || description) @@ to_tsquery(?1)"));
        metadataBuilder.applySqlFunction("cfts", new SQLFunctionTemplate(BooleanType.INSTANCE, "to_tsvector(?1) @@ to_tsquery(?2)"));
    }

}

Basically I need to do full text search on multiple tables/entities with multiple columns (i.e., columns/fields to be passed dynamically to to_tsvector() as the columns/fields will be varying according to the tables/entities)

Note: No Table Joining concept.

Help would be appreciated.


问:
Is it possible to ignore duplicate errors at spring data with MongoRepository saveAll function?
Is it possible to ignore duplicate errors at spring data with MongoRepository saveAll function? i have a two concurrent writers to mongodb and they are saving same content and i want to be safe, that while saving on both sides with saveall works well (one can be have a duplication error) and not both of them throws duplication error on same time and nothing will be saved in db.

concurrent saving only one must win to save list with saveall


问:
Why does one of my columns not show when I try to implement it in the Select statement
The problem is that one of my columns is not showing and I get this error message

MISSING FORM clause entry for table \r\

I tried this

```<code>SELECT MAX(amount) AS amount FROM (SELECT starttime, COUNT(playlistitemid) AS amount FROM radiobroadcast LEFT JOIN playlistitem USING (radiobroadcastid) GROUP BY starttime) r
</code>```

and with this only the table amount is shown Then I tried this

```<code>SELECT r.starttime, MAX(amount) AS amount FROM (SELECT starttime, COUNT(playlistitemid) AS amount FROM radiobroadcast LEFT JOIN playlistitem USING (radiobroadcastid) GROUP BY r.starttime) r
</code>```

And then I got the error message

So could you please explain why it is not working?

Body:
The problem is that one of my columns is not showing and I get this error message

MISSING FORM clause entry for table \r\

I tried this

SELECT MAX(amount) AS amount FROM (SELECT starttime, COUNT(playlistitemid) AS amount FROM radiobroadcast LEFT JOIN playlistitem USING (radiobroadcastid) GROUP BY starttime) r

and with this only the table amount is shown Then I tried this

SELECT r.starttime, MAX(amount) AS amount FROM (SELECT starttime, COUNT(playlistitemid) AS amount FROM radiobroadcast LEFT JOIN playlistitem USING (radiobroadcastid) GROUP BY r.starttime) r

And then I got the error message

So could you please explain why it is not working?


问:
In python, 12//5 is 2 then why -12//5 is not -2?

When I tried -12//5 I expected -2 but it returned -3.
why it is so?


问:
How to take .NET Web API from a development to production?
Im trying to deploy my web application with the following set up:

Frontend - Vue.js

Backend - .NET 6 Web API

Database - PostgreSQL

Im using DigitalOcean to deploy it and since I'm new to programming and deployment in general I'm having some struggles. I have created my database on their platform and imported all my information. Now I'm trying to connect it to my backend application but I'm unaware of how exactly it has to be done (I will upload both the front and backend applications on their "App platform"). More precisely, I dont know what I need to do in my code (in .NET) to make the connection to the database (I tried using the connection string of the cloud database) and also make a secure development to production transition so I can upload the .NET Web API application and have it work. Any advice and/or criticism is going to be of a significant help for me, I'm new and want to learn.


问:
Is there a way to get all tables/views used to make a view? (Including parents and "grandparents")
Some VIEWs are joins of multiple views and tables, which in turn were joined from other views and tables, and so on.

The rabbit holes appear deep from looking into them manually. (Following the thread of all the joins by pulling up the view creation scripts, one after another, after another, after another...you get the idea.)

Some of our queries are taking the approximate speed of paint drying. I was hoping there was a way to quickly call up the "family trees" of some of our more problematic views to get a full picture of their "ancestry."

Is there a system function, stored procedure, query, or other functionality in SSMS that will give me a list (or diagram, if it's a SSMS built-in functionality) of all "parents"/"grandparents"/"great-grandparents"/etc. of a view? (Or a table for that matter?)

I did a fairly exhaustive Google search (and searched here on SO and similar sites) for a solution, but I couldn't find what I was looking for. I think one issue is that I don't know the proper terminology (e.g., I don't think "parents" and "grandparents" are the right words here).

If there are more proper terms for the functionality/objects that I am talking about, I would appreciate any corrections.


问:
How to handle RVEST:::request_POST in today's RVEST package?
rvest's internal function rvest:::request_POST is deprecated / not working anymore. How should the request be handled today?

I would like to perform a POST using the session collected previously and this function used to be my go-to. Now that it is deprecated, can someone please help me.

Any suggestion?