Re: Problem with Avg function and Money type in PostgreSQL 15

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Problem with Avg function and Money type in PostgreSQL 15
Date: 2022-10-30 17:57:37
Message-ID: 241789.1667152657@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee> writes:
> CREATE TABLE Product(product_id SERIAL PRIMARY KEY,
> price MONEY NOT NULL);

> INSERT INTO Product(price) VALUES (30);
> INSERT INTO Product(price) VALUES (40);

> SELECT Avg(price) AS av FROM Product;

> PostgreSQL 15

> 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.
> CONTEXT: SQL function "avg" during inlining

I get "function avg(money) does not exist" in all branches.
Judging from the mention of a SQL function, you must have
created a not-very-well-thought-out SQL function named "avg",
and that function is recursing till stack overflow.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Erki Eessaar 2022-10-30 19:10:10 Re: Problem with Avg function and Money type in PostgreSQL 15
Previous Message Lauri Laanmets 2022-10-30 17:13:36 Memory leak on subquery as scalar operand