pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problem with Avg function and Money type in PostgreSQL 15
3+ messages / 2 participants
[nested] [flat]

* Problem with Avg function and Money type in PostgreSQL 15
@ 2022-10-30 10:15 Erki Eessaar <erki.eessaar@taltech.ee>
  2022-10-30 17:57 ` Re: Problem with Avg function and Money type in PostgreSQL 15 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Erki Eessaar @ 2022-10-30 10:15 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

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 14.5

ERROR:  function avg(money) does not exist
LINE 1: SELECT Avg(price) AS av FROM Product;
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.


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
SQL function "avg" during startup
SQL function "avg" statement 1 --this line is repeated more than 3000 times

It seems to me that PostgreSQL 14.5 response is much better than in case of PostgreSQL 15.

Best regards
Erki Eessaar

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

* Re: Problem with Avg function and Money type in PostgreSQL 15
  2022-10-30 10:15 Problem with Avg function and Money type in PostgreSQL 15 Erki Eessaar <erki.eessaar@taltech.ee>
@ 2022-10-30 17:57 ` Tom Lane <tgl@sss.pgh.pa.us>
  2022-10-30 19:10   ` Re: Problem with Avg function and Money type in PostgreSQL 15 Erki Eessaar <erki.eessaar@taltech.ee>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2022-10-30 17:57 UTC (permalink / raw)
  To: Erki Eessaar <erki.eessaar@taltech.ee>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

Erki Eessaar <erki.eessaar@taltech.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





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

* Re: Problem with Avg function and Money type in PostgreSQL 15
  2022-10-30 10:15 Problem with Avg function and Money type in PostgreSQL 15 Erki Eessaar <erki.eessaar@taltech.ee>
  2022-10-30 17:57 ` Re: Problem with Avg function and Money type in PostgreSQL 15 Tom Lane <tgl@sss.pgh.pa.us>
@ 2022-10-30 19:10   ` Erki Eessaar <erki.eessaar@taltech.ee>
  0 siblings, 0 replies; 3+ messages in thread

From: Erki Eessaar @ 2022-10-30 19:10 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>

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@sss.pgh.pa.us>
Sent: Sunday, October 30, 2022 7:57 PM
To: Erki Eessaar <erki.eessaar@taltech.ee>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Problem with Avg function and Money type in PostgreSQL 15

Erki Eessaar <erki.eessaar@taltech.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

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


end of thread, other threads:[~2022-10-30 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-30 10:15 Problem with Avg function and Money type in PostgreSQL 15 Erki Eessaar <erki.eessaar@taltech.ee>
2022-10-30 17:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-10-30 19:10   ` Erki Eessaar <erki.eessaar@taltech.ee>

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