Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tkmKE-006jVR-7u for pgsql-general@arkaria.postgresql.org; Wed, 19 Feb 2025 15:49:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tkmKB-00AFbQ-Oh for pgsql-general@arkaria.postgresql.org; Wed, 19 Feb 2025 15:49:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tkmKB-00AFbI-Df for pgsql-general@lists.postgresql.org; Wed, 19 Feb 2025 15:49:23 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tkmK9-001jh2-30 for pgsql-general@lists.postgresql.org; Wed, 19 Feb 2025 15:49:22 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-388cae9eb9fso3629537f8f.3 for ; Wed, 19 Feb 2025 07:49:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739980160; x=1740584960; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=a76eRA0OXTr3xWjfFoAV64qCIlwAcsSceuAXS4Ascyk=; b=It54swT1SgErrIgPqBKSkyyqQNpkaa0hDnjVnrKtXqRca46PFgDsU+GC18B4dsaXTE yI7TWZLb6e72ey93nRv/QscAQF0yfvHCgVeNko5N/B5UqTs+r7Qts3UxGTa1xDkkdUn8 bberWE0Sjt8ilegR6JrjUN8a51ZQT/Jsx3Ih7o716e0MKwU5IsaJrst88L0QcVUf+smK zOLutaemhTsEmH4q5LeU8GoEQnsLqKi3abG/qzPIM26C3ZNIQVdv3DCh+NUat4sRJdbt Cc0SXQQac7P+5UlfP0va/4PSbBHSMmr7TN5eBWZBGiVAY+lP+Zozkh94M2GZr0T/iED8 +9JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739980160; x=1740584960; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=a76eRA0OXTr3xWjfFoAV64qCIlwAcsSceuAXS4Ascyk=; b=HCKAq4FehQWB0fQliJLfgIv9RyUvazKoS3Y1wGLGiZiduoFUTqGwf1A3v8nWIIxxCy Z7/cqz88z6oU+LE7Dbkcp/gpQQMTPQP/HN9nLrDaEjnmVjxrSrkK+SliMMmuRZQNJO5y rqS01rb5gTJ8WsB1en6g4tmvICSOZ5+oOycrQDjsXHgN9YXieNeQFj7Ly6h6I2YpuszO je+J+8ZqHZNoDel2do2blBO4hS7nCkVXgOBSgw6+L6x2k6ZphDWO2OBJzIZ20qK8j1RL lyXfT13ZDIovcDacPf0+kBQzbndUzX0kbXGVyHXlNBwDWBEaI17/EBR5H89cVTBQLTf3 P3ZA== X-Gm-Message-State: AOJu0YyojgV/+2+GUwKFI0GIY8wjlHfrTD2dcYxt12UkkSLxhPFzM8Sv dbcillGpjL8C92tfM3n4mrsMaDxWYGMCKk9mY4WlI7Y3lkCoXWL9pp+cvXAA8R5wnqY4sji/i4K wiDbos6Jm+f1iOZY7zI9U7QyulHIveNpm3JY= X-Gm-Gg: ASbGncuwIEoyLp4GnCMcEDwum4SoYHCSrOfRa7AdsunIikjCUkCV/fYOYDYDyZwwoi/ U3UYPuzn0KpPGX+fh94N9a/Dw4WjW9tjrzL4YyoB6h5RYaiHZ0DcbFJYE0v5TkqIrRKZ9wrdo X-Google-Smtp-Source: AGHT+IH08vdWt7kSexuwFkDF0fxhId1yPe/CnnrTwrnpFkuY7yxJRcn4WrjBnCocMKu+AJrFIDKHKUTTqaAtOjVnd58= X-Received: by 2002:a5d:6484:0:b0:38f:4c30:7cdd with SMTP id ffacd0b85a97d-38f4c307ec0mr9592155f8f.37.1739980160208; Wed, 19 Feb 2025 07:49:20 -0800 (PST) MIME-Version: 1.0 References: <2b9a5afa4abfcdbab0a585c1a77279dc90a60a83.camel@cybertec.at> In-Reply-To: <2b9a5afa4abfcdbab0a585c1a77279dc90a60a83.camel@cybertec.at> Reply-To: csanyipal@gmail.com From: =?UTF-8?B?Q3PDoW55aSBQw6Fs?= Date: Wed, 19 Feb 2025 16:49:07 +0100 X-Gm-Features: AWEUYZnAsMUrIkZTpVMzXb6gfmHn4vEzs8KuGSeH9TaQlVmMHI3_-rjAaNvhaJ8 Message-ID: Subject: Re: ERROR: stack depth limit exceeded To: Laurenz Albe Cc: general pgsql Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe ezt =C3=ADrta (id=C5=91pont: 2025. = febr. 19., Sze, 12:22): > > On Wed, 2025-02-19 at 11:23 +0100, Cs=C3=A1nyi P=C3=A1l wrote: > > I am running postgresql 15 on Debian 12 operating system. > > I also installed PgAdmin4 and am using the desktop version of it. > > I have created a trigger function and a trigger which will run the > > following code, see below. > > Before this trigger would run, I tried this code. > > When running the code I get the following error message: > > ERROR: stack depth limit exceeded HINT: Increase the configuration > > parameter "max_stack_depth" (currently 2048kB), after ensuring the > > platform's stack depth limit is adequate. > > > > Where am I making a mistake, and what can I do to make this code and > > this trigger run successfully? > > You don't show the entire function and the trigger definition, Hi Laurenz, the trigger function definition is like: BEGIN INSERT INTO HAVONKENTI_MEGTAKARITASAINK (EZEN_IDOKOZBEN, MEGTAKARITVA_RSD, KELT) VALUES ((tsrange(( SELECT KELT FROM PUBLIC.JAVAINK_FORGALMA WHERE EN_KAPTAM =3D 'true' AND AZ_ARU_NEVE =3D 'nyugd=C3=ADjam' ORDER BY KELT DESC LIMIT 1 OFFSET 1 ),( SELECT KELT FROM PUBLIC.JAVAINK_FORGALMA WHERE EN_KAPTAM =3D 'true' AND AZ_ARU_NEVE =3D 'nyugd=C3=ADjam' ORDER BY KELT DESC LIMIT 1 OFFSET 0 ),'[)')),(SELECT SUM(EGYSEGAR * ENNYI_EGYSEG) FROM PUBLIC.JAVAINK_FORGALMA WHERE A_PENZNEM =3D 'RSD' AND KELT >=3D ( SELECT KELT FROM PUBLIC.JAVAINK_FORGALMA WHERE EN_KAPTAM =3D 'true' AND AZ_ARU_NEVE =3D 'nyugd=C3=ADjam' ORDER BY KELT DESC LIMIT 1 OFFSET 1 ) AND KELT < ( SELECT KELT FROM PUBLIC.JAVAINK_FORGALMA WHERE EN_KAPTAM =3D 'true' AND AZ_ARU_NEVE =3D 'nyugd=C3=ADjam' ORDER BY KELT DESC LIMIT 1 OFFSET 0 )), DEFAULT) ; END; and the trigger definition is like: CREATE OR REPLACE TRIGGER uj_nyugdij_beirasakor_kiold AFTER INSERT ON public.javaink_forgalma FOR EACH ROW EXECUTE FUNCTION public.ket_nyugdij_kozotti_megtakaritasaink(); COMMENT ON TRIGGER uj_nyugdij_beirasakor_kiold ON public.javaink_forgalma IS '=C3=9Aj nyugd=C3=ADj be=C3=ADr=C3=A1sakor kioldja a k=C3=A9t nyugd= =C3=ADj k=C3=B6z=C3=B6tti megtakar=C3=ADt=C3=A1saink nev=C5=B1 szerepet.'; > but from the symptoms it is pretty clear that the trigger is > modifying the table on which it is defined. That will call the > trigger again and lead to an endless recursion, which leads to > the observed error. > > Yours, > Laurenz Albe Indeed I did, the trigger should have been assigned on javaink_forgalma table, not on havonkenti_megtakaritasaink table. Actually, this trigger has been assigned on both tables so far, and I just deleted it from the havonkenti_megtakaritasaink table by using PgAdmin4. Now that I only have this trigger assigned on the javaink_forgalma table, an INSERT command into this table will activate the trigger function, which will then insert a new row in the havonkenti_megtakaritasaink table. However, by copying the code between BEGIN and END from the trigger function, and inserting it into the Query tool and then running this code there, it should insert a line in the havonkenti_megtakaritasaink table. But here I got the error message mentioned above. Hey! But now this code snippet ran without any errors! So what happened here? Thanks for all the advice! --=20 Best wishes by Paul Chanyi!