Re: Application written in pure pgsql, good idea?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Jan de Visser <jan(at)de-visser(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Application written in pure pgsql, good idea?
Date: 2015-02-28 22:14:50
Message-ID: 54F23DDA.3020803@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/28/2015 01:39 PM, Jan de Visser wrote:
> On February 28, 2015 03:39:06 PM inspector morse wrote:
>> Is it a good idea to write a simple application (consisting of just data
>> entry interfaces) in pure pgsql?
>>
>> Basically, we would have each page has a stored function in postgresql that
>> is called by php+apache (the http get/post values would be passed into
>> postgrel as an array).
>>
>> The pgpsql would render HTML and return back to the front end for display.
>>
>> Sample:
>> create function render_user_login_page(out v_html varchar)
>> returns varchar
>> as
>> $$
>> begin
>> v_html := v_html || '<table><tr><td>User ID:</td><td><input
>> type="text" /></td></tr></table>';
>> end;
>> $$
>>
>>
>> Would there be any performance issues with doing this?
>
> Don't know about the performance aspects, but just thinking about it you're
> making your db server responsible for a lot of cruft that can easily be
> outsourced - the HTML rendering. Which, besides being a potential performance
> pitfall, will probably end up being a terrible maintenance nightmare.

The thought of doing CREATE OR REPLACE FUNCTION every time a Web page
needed to be modified gives me the jitters.

>
> What's the problem with letting PHP do what it's good at, i.e. rendering
> templatized HTML, and let the DB do what it's good at - data processing? The
> idea of sending stuff over straight to the DB sounds sane, but instead of doing
> that terrible string concat stuff you're thinking of just send back some
> structured data which you then render in PHP?

Yea, I am pretty sure that was the problem REST was created to solve.

>
>
>
>

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Steele 2015-03-01 01:39:14 Re: Performance on DISABLE TRIGGER
Previous Message Jan de Visser 2015-02-28 21:39:16 Re: Application written in pure pgsql, good idea?