Search Postgresql Archives

Re: Using Postgresql as application server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 15. August 2011 16.36.23 Merlin Moncure wrote:
> Postgres is not just a database -- it's a language hosting platform if
> you want to use it as such.  Now, you can continue to do things as
> you've always done (database 'here', code 'here', web server 'here'),
> but why discourage people from trying out different things?

Somebody's probably going to do it -- for no other reason why than because you 
can.

Sometimes I'll write functions like

CREATE OR REPLACE FUNCTION dpp(INTEGER) RETURNS SETOF TEXT AS $$
    SELECT '<p class="packed">' || ss_link_expand(source_text) || '</p>'
    FROM sources
    WHERE parent_id=$1
    ORDER BY sort_order
$$ LANGUAGE SQL STABLE;

for dumping thext that I'll copy and paste right into a static Web page. It's 
a lot easier to do this in psql than a lot of other methods that I can think 
of.

BTW, the mentioned ss_link_expand() function will generate hyperlinks on the 
fly from a compact format stored in the database. The concept is explained 
here: <http://solumslekt.org/blog/?p=151>

I'm working with Postgres and PHP in tandem, and frequently write functions in 
sql or pl/pgsql that will output text directly in HTML format, mostly because 
I've found text transformation (particularly regexp_replace) in Postgres to be 
far superior to the equivalent methods of doing it in PHP.

Leif

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux