From: | Leif Biberg Kristensen <leif(at)solumslekt(dot)org> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Using Postgresql as application server |
Date: | 2011-08-15 16:24:30 |
Message-ID: | 201108151824.31013.leif@solumslekt.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Benjamin Krajmalnik | 2011-08-15 16:46:26 | Re: Using Postgresql as application server |
Previous Message | Chris Travers | 2011-08-15 16:22:55 | Re: Using Postgresql as application server |
From | Date | Subject | |
---|---|---|---|
Next Message | Benjamin Krajmalnik | 2011-08-15 16:46:26 | Re: Using Postgresql as application server |
Previous Message | Chris Travers | 2011-08-15 16:22:55 | Re: Using Postgresql as application server |