Re: [HACKERS] why pg_size_pretty is volatile?

2016-01-26 Thread Fujii Masao
On Tue, Jan 26, 2016 at 3:00 PM, Pavel Stehule  wrote:
>
>
> 2016-01-26 2:00 GMT+01:00 Michael Paquier :
>>
>> On Tue, Jan 26, 2016 at 5:35 AM, Pavel Stehule 
>> 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


Re: [HACKERS] why pg_size_pretty is volatile?

2016-01-25 Thread Pavel Stehule
2016-01-26 2:00 GMT+01:00 Michael Paquier :

> On Tue, Jan 26, 2016 at 5:35 AM, Pavel Stehule 
> 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


> --
> Michael
>
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
new file mode 100644
index 79e92ff..3a066ab
*** a/src/include/catalog/pg_proc.h
--- b/src/include/catalog/pg_proc.h
*** DATA(insert OID = 2332 ( pg_relation_siz
*** 3583,3591 
  DESCR("disk space usage for the specified fork of a table or index");
  DATA(insert OID = 2286 ( pg_total_relation_size PGNSP PGUID 12 1 0 0 0 f f f f t f v s 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_ pg_total_relation_size _null_ _null_ _null_ ));
  DESCR("total disk space usage for the specified table and associated indexes");
! DATA(insert OID = 2288 ( pg_size_pretty			PGNSP PGUID 12 1 0 0 0 f f f f t f v s 1 0 25 "20" _null_ _null_ _null_ _null_ _null_ pg_size_pretty _null_ _null_ _null_ ));
  DESCR("convert a long int to a human readable text using size units");
! DATA(insert OID = 3166 ( pg_size_pretty			PGNSP PGUID 12 1 0 0 0 f f f f t f v s 1 0 25 "1700" _null_ _null_ _null_ _null_ _null_ pg_size_pretty_numeric _null_ _null_ _null_ ));
  DESCR("convert a numeric to a human readable text using size units");
  DATA(insert OID = 2997 ( pg_table_size			PGNSP PGUID 12 1 0 0 0 f f f f t f v s 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_ pg_table_size _null_ _null_ _null_ ));
  DESCR("disk space usage for the specified table, including TOAST, free space and visibility map");
--- 3583,3591 
  DESCR("disk space usage for the specified fork of a table or index");
  DATA(insert OID = 2286 ( pg_total_relation_size PGNSP PGUID 12 1 0 0 0 f f f f t f v s 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_ pg_total_relation_size _null_ _null_ _null_ ));
  DESCR("total disk space usage for the specified table and associated indexes");
! DATA(insert OID = 2288 ( pg_size_pretty			PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 25 "20" _null_ _null_ _null_ _null_ _null_ pg_size_pretty _null_ _null_ _null_ ));
  DESCR("convert a long int to a human readable text using size units");
! DATA(insert OID = 3166 ( pg_size_pretty			PGNSP PGUID 12 1 0 0 0 f f f f t f i s 1 0 25 "1700" _null_ _null_ _null_ _null_ _null_ pg_size_pretty_numeric _null_ _null_ _null_ ));
  DESCR("convert a numeric to a human readable text using size units");
  DATA(insert OID = 2997 ( pg_table_size			PGNSP PGUID 12 1 0 0 0 f f f f t f v s 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_ pg_table_size _null_ _null_ _null_ ));
  DESCR("disk space usage for the specified table, including TOAST, free space and visibility map");

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


[HACKERS] why pg_size_pretty is volatile?

2016-01-25 Thread Pavel Stehule
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


Re: [HACKERS] why pg_size_pretty is volatile?

2016-01-25 Thread Michael Paquier
On Tue, Jan 26, 2016 at 5:35 AM, Pavel Stehule  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