array_fill function

Started by Pavel Stehuleabout 18 years ago2 messagespatches
Jump to latest
#1Pavel Stehule
pavel.stehule@gmail.com

Hello

Proposal: http://archives.postgresql.org/pgsql-hackers/2008-06/msg00057.php

I changed name to array_fill and order of arguments.

postgres=# SELECT array_fill(0, ARRAY[2,3]);
array_fill
-------------------
{{0,0,0},{0,0,0}}
(1 row)

postgres=# SELECT array_fill(0, ARRAY[2,3], ARRAY[1,2]);
array_fill
------------------------------
[1:2][2:4]={{0,0,0},{0,0,0}}
(1 row)

postgres=# SELECT array_fill(0, ARRAY[4], ARRAY[2]);
array_fill
-----------------
[2:5]={0,0,0,0}
(1 row)

postgres=# SELECT array_fill(NULL::int, ARRAY[4]);
array_fill
-----------------------
{NULL,NULL,NULL,NULL}
(1 row)

Regards
Pavel Stehule

Attachments:

array_fill.difftext/x-patch; name=array_fill.diffDownload+354-6
#2Bruce Momjian
bruce@momjian.us
In reply to: Pavel Stehule (#1)
Re: array_fill function

Patch applied, with minor adjustments in error message wording, with
documntation added; committed patch attached.

---------------------------------------------------------------------------

Pavel Stehule wrote:

Hello

Proposal: http://archives.postgresql.org/pgsql-hackers/2008-06/msg00057.php

I changed name to array_fill and order of arguments.

postgres=# SELECT array_fill(0, ARRAY[2,3]);
array_fill
-------------------
{{0,0,0},{0,0,0}}
(1 row)

postgres=# SELECT array_fill(0, ARRAY[2,3], ARRAY[1,2]);
array_fill
------------------------------
[1:2][2:4]={{0,0,0},{0,0,0}}
(1 row)

postgres=# SELECT array_fill(0, ARRAY[4], ARRAY[2]);
array_fill
-----------------
[2:5]={0,0,0,0}
(1 row)

postgres=# SELECT array_fill(NULL::int, ARRAY[4]);
array_fill
-----------------------
{NULL,NULL,NULL,NULL}
(1 row)

Regards
Pavel Stehule

[ Attachment, skipping... ]

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

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachments:

/rtmp/difftext/x-diffDownload+369-8