why pg_size_pretty is volatile?

Started by Pavel Stehuleabout 10 years ago4 messageshackers
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

Hi

Vitaly Burovoy pointed on bug in my patch - a pg_size_bytes was VOLATILE
function. It is copy/paste bug - I used pg_size_pretty definition, so the
question is: why pg_size_pretty is volatile? It should be immutable too.

Regards

Pavel

#2Michael Paquier
michael@paquier.xyz
In reply to: Pavel Stehule (#1)
Re: why pg_size_pretty is volatile?

On Tue, Jan 26, 2016 at 5:35 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:

Vitaly Burovoy pointed on bug in my patch - a pg_size_bytes was VOLATILE
function. It is copy/paste bug - I used pg_size_pretty definition, so the
question is: why pg_size_pretty is volatile? It should be immutable too.

+1. This function relies only on the input of its argument to generate a result.
-- 
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Pavel Stehule
pavel.stehule@gmail.com
In reply to: Michael Paquier (#2)
Re: why pg_size_pretty is volatile?

2016-01-26 2:00 GMT+01:00 Michael Paquier <michael.paquier@gmail.com>:

On Tue, Jan 26, 2016 at 5:35 AM, Pavel Stehule <pavel.stehule@gmail.com>
wrote:

Vitaly Burovoy pointed on bug in my patch - a pg_size_bytes was VOLATILE
function. It is copy/paste bug - I used pg_size_pretty definition, so the
question is: why pg_size_pretty is volatile? It should be immutable too.

+1. This function relies only on the input of its argument to generate a
result.

attached patch

all tests passed

Regards

Pavel

Show quoted text

--
Michael

Attachments:

pg_size_pretty-immutable.patchtext/x-patch; charset=US-ASCII; name=pg_size_pretty-immutable.patchDownload+4-4
#4Fujii Masao
masao.fujii@gmail.com
In reply to: Pavel Stehule (#3)
Re: why pg_size_pretty is volatile?

On Tue, Jan 26, 2016 at 3:00 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:

2016-01-26 2:00 GMT+01:00 Michael Paquier <michael.paquier@gmail.com>:

On Tue, Jan 26, 2016 at 5:35 AM, Pavel Stehule <pavel.stehule@gmail.com>
wrote:

Vitaly Burovoy pointed on bug in my patch - a pg_size_bytes was VOLATILE
function. It is copy/paste bug - I used pg_size_pretty definition, so
the
question is: why pg_size_pretty is volatile? It should be immutable too.

+1. This function relies only on the input of its argument to generate a
result.

attached patch

all tests passed

Pushed. Thanks!

Regards,

--
Fujii Masao

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers