Re: helo

From: Allan Kamau <kamauallan(at)gmail(dot)com>
To: beulah prasanthi <itsbeulah(at)gmail(dot)com>
Cc: Postgres General Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: helo
Date: 2010-02-22 16:01:55
Message-ID: ab1ea6541002220801s6d3a0dbeoc07c1b2575131248@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

On Mon, Feb 22, 2010 at 2:10 PM, beulah prasanthi <itsbeulah(at)gmail(dot)com> wrote:
> Helo
>      I am working on spring project with postgres 8.4
> i wrote a function in postgrees which i am passing the argument email
> email[] array
> From front end we need to insesrt data into that emailarray .so i used
> java.arraylist.util
> while i am running i got the following error Please help me
>
> error:
> org.postgresql.util.PSQLException: Cannot cast an instance of
> java.util.ArrayList to type Types.ARRAY

You have cross-posted.

You may want to compose a comma separated values string out of the
values you'd like to send as an array, Then send this string instead
of the array (ofcourse for your postgreSQL function, you will need to
change the datatype of your input variable to TEXT). Then inside your
postgres function unpack the CSV text into an array using some regular
expression(s).

maybe something like this.

Assuming "_my_CSV_string" is your text variable that contains the CSV data.

SELECT * FROM regexp_split_to_array(_my_CSV_string,E',(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))'))AS
my_array;

Allan.

In response to

  • helo at 2010-02-22 11:10:41 from beulah prasanthi

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-02-22 17:13:50 Re: BUG #5338: PG_DUMP fails due to invalid adnum value
Previous Message Kevin Grittner 2010-02-22 15:34:44 Re: Fwd: exception in plsql

Browse pgsql-general by date

  From Date Subject
Next Message Yang Zhang 2010-02-22 16:36:15 Performance cost of a sort-merge join
Previous Message Albe Laurenz 2010-02-22 15:47:01 Re: tsearch2 gives NOTICE: word is too long