Re: calling function

From: Bhushan Bhangale <bbhangale(at)Lastminute(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: calling function
Date: 2004-03-02 15:44:51
Message-ID: C9590F897BFAD7119E63000BCD6820830165944A@lmnukpriv.lastminute.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi Tom,

Well actually it worked via java now.

But I am really interested in what you said about first call.

I am creating the temp_accomm table everytime I call the function and drop
it in the end.

Let me explain the functionality. I need to get the result of a query which
joins 4 tables. The problem is because of this join I get more than one
record for one accomodation which is fine as there are multiple child images
for a accomm. What I have to do is concatenate the column of image table and
return in the resultset.

The out put looks like this

412|Hotel Cristallo|0|0|901#902|r82h06.jpg#r82h06.jpg|Hotel Cristallo#Hotel
Cristallo
413|Campo Smith Village|0|0|903#904|r83a06.jpg#r83a06.jpg|Campo Smith
Village and Great Western Hotel Rive#Campo Smith Village and Great Western
Hotel Rive

Do you still see any problem here.

One more thing in MS-SQL I used to create temp table using #. How can I do
that here in postgres?

Thanks
Bhushan

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: 02 March 2004 15:16
To: Bhushan Bhangale
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] calling function

Bhushan Bhangale <bbhangale(at)Lastminute(dot)com> writes:
> Error: ERROR: relation with OID 659490 does not exist (State:S1000,
Native
> Code: 7)

That function is only going to work once per session, because plpgsql
caches query plans. After the first call, the commands in the loop will
refer to a version of temp_accomm that doesn't exist anymore.

AFAICS you do not actually need the temp_accum table anyway. Why don't
you just return the data directly from the main loop?

regards, tom lane

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Browse pgsql-jdbc by date

  From Date Subject
Next Message Sean Elliott 2004-03-02 17:07:35 Passing parameters to functions from Java
Previous Message Tom Lane 2004-03-02 15:15:52 Re: calling function