From: idc danny <idcdanny@yahoo.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Array fundamentals
Date: Sat, 2 Jun 2012 10:05:30 -0700 (PDT)
Message-ID: <1338656730.99764.YahooMailNeo@web110416.mail.gq1.yahoo.com> (raw)
In-Reply-To: <4FC8862B.70103@gmail.com>
References: <4FC7F0DB.40600@atlassian.com>
<CAFwQ8rcEyUyhyUHrhQRzJk=DRVYhZT9-mJmvKAPoD8+8_NWG5g@mail.gmail.com>
<4FC7F844.8070205@atlassian.com>
<CAFwQ8rf89H+BCvua_EnjtPPK1onrxUA_mMDA8nr9hd5VgQvtcA@mail.gmail.com>
<4FC80000.2000900@atlassian.com>
<4FC8862B.70103@gmail.com>
Hi all,
I got 2 complementary functions, which will do opposite things.
1 - CombineStrings(stringarray character varying[]) RETURNS character varying
This one will take as parameter an array of strings and will return a string with some formatted information inside
2- SplitString2Array(stringtosplit character varying) RETURNS character varying[]
This one will take as parameter a formatted string and will return an array of string
The following is true, both works just fine :
select SplitString2Array(CombineStrings(ARRAY['abba', 'queen']))
will return {'abba', 'queen'}
Now, if I want do do the following:
select CombineStrings(ARRAY[SplitString2Array("SomeTextColumn"), 'New string to add']) from "SomeTable"
i get the following error:
array value must start with "{" or dimension information
What am I doing wrong, I am feeling I still don't get the array fundamentals. My goal is to add to inside formatted information in the column "SomeTextColumn" my new string 'New string to add' in the same manner if I would been used the following:
Insert into "SomeTable"("SomeTextColumn") values (CombineString(ARRAY['abba', 'queen', 'New string to add']))
Thank you in advance,
Danny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: idcdanny@yahoo.com
Subject: Re: Array fundamentals
In-Reply-To: <1338656730.99764.YahooMailNeo@web110416.mail.gq1.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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