public inbox for [email protected]  
help / color / mirror / Atom feed
ERROR: stack depth limit exceeded
2+ messages / 2 participants
[nested] [flat]

* ERROR: stack depth limit exceeded
@ 2025-02-19 10:23  Csányi Pál <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Csányi Pál @ 2025-02-19 10:23 UTC (permalink / raw)
  To: general pgsql <[email protected]>

Hi,

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?

-- Insert the RSD saved between my last two pensions in the
haavi_megtakaritasaink table.
-- INSERT INTO x(a) VALUES (tsrange($1, $2, '[)'));
-- Includes the first date [, the second date is not ).
INSERT INTO
    vagyonunk_kezelese.public.havonkenti_megtakaritasaink
(ezen_idokozben, megtakaritva_rsd, kelt)
VALUES ((select tsrange((
        SELECT
            kelt
        FROM
            javaink_forgalma
        WHERE
            EN_KAPTAM = 'true'
            AND AZ_ARU_NEVE = 'nyugdíjam'
        ORDER BY
            KELT DESC
        LIMIT
            1
        OFFSET
            1
    ),(
        SELECT
            KELT
        FROM
            JAVAINK_FORGALMA
        WHERE
            EN_KAPTAM = 'true'
            AND AZ_ARU_NEVE = 'nyugdíjam'
        ORDER BY
            KELT DESC
        LIMIT
            1
        OFFSET
            0
    ),'[)')),(SELECT
    SUM(EGYSEGAR * ENNYI_EGYSEG)
FROM
    JAVAINK_FORGALMA
WHERE
    A_PENZNEM = 'RSD'
    AND KELT >= (
        SELECT
            KELT
        FROM
            JAVAINK_FORGALMA
        WHERE
            EN_KAPTAM = 'true'
            AND AZ_ARU_NEVE = 'nyugdíjam'
        ORDER BY
            KELT DESC
        LIMIT
            1
        OFFSET
            1
    )
    AND KELT < (
        SELECT
            KELT
        FROM
            JAVAINK_FORGALMA
        WHERE
            EN_KAPTAM = 'true'
            AND AZ_ARU_NEVE = 'nyugdíjam'
        ORDER BY
            KELT DESC
        LIMIT
            1
        OFFSET
            0
    )), DEFAULT)
;

Thanks for all the advice!

--
Best wishes by Paul Chanyi!






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ERROR: stack depth limit exceeded
@ 2025-02-19 14:31  Greg Sabino Mullane <[email protected]>
  parent: Csányi Pál <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Greg Sabino Mullane @ 2025-02-19 14:31 UTC (permalink / raw)
  To: [email protected]; +Cc: general pgsql <[email protected]>

Not related to the main question, but that query could use a little
adjustment. Something like:

WITH x AS (
  select kelt from javaink_forgalma
  where en_kaptam is true and az_aru_neve = 'nyugdíjam'
  order by kelt desc limit 2
)
,y AS (select min(kelt) from x)
,z AS (select max(kelt) from x)
INSERT INTO public.havonkenti_megtakaritasaink (ezen_idokozben,
megtakaritva_rsd, kelt)
VALUES (
  (select tsrange(min,max,'[)') FROM y,z)
, (select sum(egysegar * ennyi_egyseg) from javaink_forgalma, y, z
   where a_penzem = 'RSD' and kelt >= min and kelt < max)
, DEFAULT
);

Also, it's best to use "timestamp with time zone" NOT "timestamp without
time zone" whenever possible (i.e. timestamptz not timestamp)

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-02-19 14:31 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-19 10:23 ERROR: stack depth limit exceeded Csányi Pál <[email protected]>
2025-02-19 14:31 ` Greg Sabino Mullane <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox