Re: [PERFORM] Array fundamentals - Mailing list pgsql-general

From Jeff Davis
Subject Re: [PERFORM] Array fundamentals
Date
Msg-id 1338657695.27686.7.camel@jdavis
Whole thread Raw
List pgsql-general
On Sat, 2012-06-02 at 10:05 -0700, idc danny wrote:
> 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

This discussion is better suited to another list, like -general, so I'm
moving it there.

In the fragment:
  ARRAY[SplitString2Array("SomeTextColumn"), 'New string to add']
The first array element is itself an array of strings, but the second is
a plain string. Array elements must all be the same type.

What you want to do is replace that fragment with something more like:
  array_append(SplitString2Array("SomeTextColumn"), 'New string to add')

If that still doesn't work, we'll need to see the exact definitions of
your functions.

Also, as a debugging strategy, I recommend that you look at the pieces
that do work, and slowly build up the fragments until it doesn't work.
That will allow you to see the inputs to each function, and it makes it
easier to see why it doesn't work.

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: Samba
Date:
Subject: Re: select current_setting('transaction_isolation')
Next
From: Alexander Reichstadt
Date:
Subject: SELECT issue with references to different tables