Skip site navigation (1) Skip section navigation (2)

Re: PERSISTANT PREPARE (another point of view)

From: Richard Huxton <dev(at)archonet(dot)com>
To: milan(dot)opa(at)gmail(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: PERSISTANT PREPARE (another point of view)
Date: 2008-07-17 08:30:45
Message-ID: 487F0335.9020207@archonet.com (view raw or flat)
Thread:
Lists: pgsql-sql
Milan Oparnica wrote:
> Milan Oparnica wrote:
>>
>> It's simply to complicated to return recordsets through server-side 
>> stored procedures. They are obviously designed to do complex data 
>> manipulation, returning few output variables informing the caller 
>> about final results. Returning records through sets of 
>> user-defined-types is memory and performance waste (please see my 
>> previous post as reply to Steve for more details).

I'm not convinced it's always a win one way or another.

 >> Plus it's hard to
>> maintain and make improvements to such a system. I hate to see 800 
>> user types made for every query we made as stored procedure.
> 
> Is this topic completely out of scope in Postgre ?
> If I'm missing something too obvious or too important, please let me 
> know what.

You still haven't said what's "too complicated" about defining a function:

CREATE FUNCTION users_at_dotcom(text) RETURNS SETOF users AS $$
   SELECT * FROM users WHERE email LIKE '%@' || $1 || '.com';
$$ LANGUAGE SQL;

SELECT * FROM users_at_dotcom('archonet');
  uid |  uname  |         email
-----+---------+-----------------------
    1 | richard | richardh(at)archonet(dot)com


-- 
   Richard Huxton
   Archonet Ltd

In response to

pgsql-sql by date

Next:From: Florian WeimerDate: 2008-07-17 10:23:28
Subject: Generating table rows from arrays
Previous:From: Pavel StehuleDate: 2008-07-17 06:13:41
Subject: Re: PERSISTANT PREPARE (another point of view)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group