Re: tab_to_sting

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Ramesh T <rameshparnanditech(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: tab_to_sting
Date: 2014-07-24 17:12:05
Message-ID: 53D13E65.8050500@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/24/2014 08:03 AM, Ramesh T wrote:
> I have try
> select string_agg(partname,':') from part_tab; its return same,
>
> ERROR: function string_agg(bigint, unknown) does not exist
> LINE 1: select string_agg(part_id,':') from part;

Try:

select string_agg(part_id::text,':') from part;

> ^
> HINT: No function matches the given name and argument types. You might
> need to add explicit type casts.
>
> i thought string_agg and array_agg same, is it right..?

No:

http://www.postgresql.org/docs/9.3/static/functions-aggregate.html

array_agg(expression) any array of the argument type input values,
including nulls, concatenated into an array

string_agg(expression, delimiter) (text, text) or (bytea, bytea) same
as argument types input values concatenated into a string, separated by
delimiter

>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vasudevan, Ramya 2014-07-24 17:13:04 Re: event triggers in 9.3.4
Previous Message Francisco Olarte 2014-07-24 17:05:17 Re: Referencing serial col's sequence for insert