Re: rowset Return from postgresql - Mailing list pgsql-sql

From Josh Berkus
Subject Re: rowset Return from postgresql
Date
Msg-id web-65016@davinci.ethosmedia.com
Whole thread Raw
List pgsql-sql
AKM,

>     I know you have an workaround idea to retrieve rowset (Resultset
> in
> JDBC) from PostGres function call in 7.1. I was looking at mailing
> archive
> to find but was not successful. If you please help me out stating
> your
> ideas, I will appreciate that.

I can understand that.  The "search" function for the list archives
seems to be rather non-functional.  

Folks, is there anything we can do to enhance/fix the archive search?
Hub.org people?  Right now I'm keeping my own archive so that I can
search it through Netscape!

The answer to your question, in a simplified form for using PL/pgSQL
functions to return rowsets for complex searches:

1. Create a sequence "search_sq"
2. Create a table searches (search_sq INT4,key_no INT4,CONSTRAINT PRIMARY KEY search_PK (search_sq, key_no) );
3. Create a view (sv_results) that defines the column set you want to
see.
4. Create a function ("search_it") that:a. grabs the s_key := Nextval('search_sq'),b. INSERT INTO searches SELECT
s_key,key_no from sv_results    WHERE ... (dynamically defined criteria)c. Return the s_key from the function.
 
5. Query from you front-end app on sv_results JOIN searches where
search_sq = s_key.


This works quite well, especially for web applications.

-Josh



______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: RE: primary key scans in sequence
Next
From: Tom Lane
Date:
Subject: Re: 7.1.1 Lock Problems on Views