ERROR: record "new" is not assigned yet
DETAIL: The tuple structure of a not-yet-assigned record is indeterminate.
CONTEXT: SQL statement "SELECT uslugi.stoim_usl FROM uslugi WHERE uslugi.id_usl = new.id_usl"
PL/pgSQL function lech() line 7 at SQL statement
CREATE OR REPLACE FUNCTION lech()
RETURNS TRIGGER
AS $$
DECLARE
sum1 int;
sum2 int;
sum3 int;
BEGIN
SELECT uslugi.stoim_usl INTO sum1
FROM uslugi WHERE uslugi.id_usl = new.id_usl;
SELECT analiz.stoim_an INTO sum2
FROM analiz WHERE analiz.id_an = new.id_an;
SELECT proc.stoim_proc INTO sum3
FROM proc WHERE proc.id_proc = new.id_proc;
new.sum := sum1+sum2+sum3;
RETURN new;
END;
$$ LANGUAGE plpgsql;
<AnchorPane prefHeight="300.0" prefWidth="713.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mainCode.view.ButtonSettingsControll">
<children>
<CheckBox fx:id="checkKal" layoutX="14.0" layoutY="14.0" mnemonicParsing="false" onAction="#handlCheckBoxKal" text="Кальяны" />
<CheckBox fx:id="checkTea" layoutX="14.0" layoutY="45.0" mnemonicParsing="false" onAction="#handlCheckBoxTea" text="Чай" />
<CheckBox fx:id="checkVIP" layoutX="12.0" layoutY="94.0" mnemonicParsing="false" onAction="#handlCheckBoxVIP" text="Vip" />
<TextField fx:id="kalHard" layoutX="176.0" layoutY="10.0" prefHeight="25.0" prefWidth="68.0" />
<TextField fx:id="priceTea" layoutX="271.0" layoutY="41.0" prefHeight="25.0" prefWidth="177.0" />
<TextField fx:id="priceUnd" layoutX="234.0" layoutY="73.0" prefHeight="25.0" prefWidth="74.0" />
<TextField fx:id="peoplsUndo" layoutX="409.0" layoutY="73.0" prefHeight="25.0" prefWidth="74.0" />
<TextField fx:id="priceOfminetsOfNormUndo" layoutX="234.0" layoutY="143.0" prefHeight="25.0" prefWidth="74.0" />
<TextField fx:id="priceOfminetsOfNormTo" layoutX="411.0" layoutY="143.0" prefHeight="25.0" prefWidth="74.0" />
<Label layoutX="331.0" layoutY="77.0" text="рублей до" />
<Label layoutX="498.0" layoutY="77.0" text="человек" />
<TextField fx:id="priceTo" layoutX="234.0" layoutY="102.0" prefHeight="25.0" prefWidth="74.0" />
<Label layoutX="320.0" layoutY="106.0" text="рублей свыше" />
<TextField fx:id="peoplsTo" layoutX="409.0" layoutY="102.0" prefHeight="25.0" prefWidth="74.0" />
<Label layoutX="498.0" layoutY="106.0" text="человек" />
<TextField fx:id="kalNorm" layoutX="325.0" layoutY="10.0" prefHeight="25.0" prefWidth="68.0" />
<TextField fx:id="kalLight" layoutX="464.0" layoutY="10.0" prefHeight="25.0" prefWidth="68.0" />
<Label layoutX="257.0" layoutY="14.0" text="тяжёлый" />
<Label layoutX="399.0" layoutY="14.0" text="средний" />
<Label layoutX="543.0" layoutY="14.0" text="легкий" />
<Label layoutX="464.0" layoutY="45.0" text="рублей за чайник" />
<Label layoutX="14.0" layoutY="142.0" text="Цена за минуту в обычном зале" />
<Label layoutX="14.0" layoutY="179.0" text="Цена за non-limited time с человека" />
<Label layoutX="327.0" layoutY="151.0" text="до закрытия" />
<Label layoutX="500.0" layoutY="147.0" text="после закрытия" />
<Label layoutX="324.0" layoutY="179.0" text="в будние дни" />
<Label layoutX="499.0" layoutY="179.0" text="в выходные дни" />
<TextField fx:id="nonLimitInBudn" layoutX="234.0" layoutY="175.0" prefHeight="25.0" prefWidth="74.0" />
<TextField fx:id="nonLimitWikand" layoutX="411.0" layoutY="175.0" prefHeight="25.0" prefWidth="74.0" />
<TextField fx:id="priceStopCheck" layoutX="273.0" layoutY="214.0" prefHeight="25.0" prefWidth="177.0" />
<Label layoutX="463.0" layoutY="218.0" text="рублей" />
<CheckBox fx:id="checkStopCheck" layoutX="12.0" layoutY="218.0" mnemonicParsing="false" onAction="#handlCheckBoxStopChek" text="Стоп-чек" />
<Button layoutX="631.0" layoutY="261.0" mnemonicParsing="false" onAction="#settings" prefHeight="25.0" prefWidth="68.0" text="Ок" />
</children>
</AnchorPane>