Re: [PERFORM] Array fundamentals

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: idc danny <idcdanny(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [PERFORM] Array fundamentals
Date: 2012-06-02 17:21:35
Message-ID: 1338657695.27686.7.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Reichstadt 2012-06-02 18:50:53 SELECT issue with references to different tables
Previous Message idc danny 2012-06-02 17:05:30 Array fundamentals

Browse pgsql-performance by date

  From Date Subject
Next Message Alejandro Carrillo 2012-06-04 16:14:11 Re: Recover rows deleted
Previous Message idc danny 2012-06-02 17:05:30 Array fundamentals