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

From: Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 19:10:10
Message-ID: AM9PR01MB8268CFF325F33A74F329E67EFE349@AM9PR01MB8268.eurprd01.prod.exchangelabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Yes, this the case. I am sorry for the false report. I retract it and apologise for the inconvinience.

Best regards
Erki Eessaar
________________________________
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Sent: Sunday, October 30, 2022 7:57 PM
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

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

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2022-10-31 05:15:44 BUG #17671: Query returns unexpected result
Previous Message Tom Lane 2022-10-30 17:57:37 Re: Problem with Avg function and Money type in PostgreSQL 15